运行 ❯
获取您的
自有
网站
×
更改方向
保存代码
更改主题,暗/亮
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript String Methods</h1> <h2>The bold() Method</h2> <p id="demo1"></p> <p>The bold() method is deprecated in JavaScript.</p> <p>Use the b tag instead:</p> <p id="demo2"></p> <script> let text = "Hello World!"; let result = text.bold(); document.getElementById("demo1").innerHTML = result; text = "<b>Hello World!</b>" document.getElementById("demo2").innerHTML = text; </script> </body> </html>