Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

String.prototype.bold()

这篇文章需要文法复核。如何帮忙。

这篇翻译不完整。请帮忙从英语翻译这篇文章

概述

bold() 方法会创建 HTML 元素 “b”,并将字符串加粗展示。

语法

str.bold()

返回值

包含HTML元素 “b”的字符串。

描述

bold() 方法将一个字符串嵌入到<b></b>标记中。

示例

使用bold()

下面的例子使用字符串方法来改变字符串的格式。

var worldString = 'Hello, world';

console.log(worldString.blink());   // <blink>Hello, world</blink>
console.log(worldString.bold());    // <b>Hello, world</b>
console.log(worldString.italics()); // <i>Hello, world</i>
console.log(worldString.strike());  // <strike>Hello, world</strike>

规范

Specification Status Comment
ECMAScript 2015 (6th Edition, ECMA-262)
String.prototype.bold
Standard Initial definition. Implemented in JavaScript 1.0. Defined in the (normative) Annex B for Additional ECMAScript Features for Web Browsers.
ECMAScript 2017 Draft (ECMA-262)
String.prototype.bold
Draft Defined in the (normative) Annex B for Additional ECMAScript Features for Web Browsers.

浏览器兼容性

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) 1.0 (1.7 or earlier) (Yes) (Yes) (Yes)
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) 1.0 (1.0) (Yes) (Yes) (Yes)

相关连接

文档标签和贡献者

 此页面的贡献者: Agp12010
 最后编辑者: Agp12010,