blob: b5a5eeb5ea12a8131324b51b187d8624adf13e93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
---
title: Symbol.replace
slug: Web/JavaScript/Reference/Global_Objects/Symbol/replace
tags:
- JavaScript
- Symbol
translation_of: Web/JavaScript/Reference/Global_Objects/Symbol/replace
---
<div>{{JSRef}}</div>
<p><code><strong>Symbol.replace</strong></code> 这个属性指定了当一个字符串替换所匹配字符串时所调用的方法。{{jsxref("String.prototype.replace()")}} 方法会调用此方法。</p>
<p>更多信息, 详见 {{jsxref("RegExp.@@replace", "RegExp.prototype[@@replace]()")}} 和 {{jsxref("String.prototype.replace()")}}。</p>
<p>{{EmbedInteractiveExample("pages/js/symbol-replace.html")}}</p>
<div>{{js_property_attributes(0,0,0)}}</div>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('ES2015', '#sec-symbol.replace', 'Symbol.replace')}}</td>
<td>{{Spec2('ES2015')}}</td>
<td>Initial definition.</td>
</tr>
<tr>
<td>{{SpecName('ESDraft', '#sec-symbol.replace', 'Symbol.replace')}}</td>
<td>{{Spec2('ESDraft')}}</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{Compat("javascript.builtins.Symbol.replace")}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li>{{jsxref("Symbol.match")}}</li>
<li>{{jsxref("Symbol.search")}}</li>
<li>{{jsxref("Symbol.split")}}</li>
<li>{{jsxref("RegExp.@@replace", "RegExp.prototype[@@replace]()")}}</li>
</ul>
|