Thanks to visit codestin.com
Credit goes to developer.mozilla.org

Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

Comment: Comment() Konstruktor

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨Oktober 2017⁩.

Der Comment() Konstruktor gibt ein neu erstelltes Comment-Objekt mit dem optional übergebenen String als Textinhalt zurück.

Syntax

js
new Comment()
new Comment(content)

Parameter

content Optional

Ein String, der den Textinhalt des Kommentars darstellt.

Rückgabewert

Ein neues Comment, das content enthält, oder ein leerer String, wenn kein Parameter angegeben wurde.

Beispiel

js
const comment = new Comment("Test");

Spezifikationen

Specification
DOM
# ref-for-dom-comment-comment①

Browser-Kompatibilität

Siehe auch