Text: Text() コンストラクター

Text() コンストラクターは新しい Text オブジェクトを返します。これは、引数で与えられたオプションの文字列をテキストコンテンツとして使用します。

構文

js
new Text()
new Text(string)

引数

  • string 省略可

返値

新しい Text オブジェクトで、string 引数の内容、引数が与えられなかった場合は空文字列を持ったものです。

js
let text = new Text("Test");

仕様書

Specification
DOM Standard
# ref-for-dom-text-text①

ブラウザーの互換性

BCD tables only load in the browser

関連情報