diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/javascript/reference/global_objects/regexp/tosource | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/regexp/tosource')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/regexp/tosource/index.html | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/regexp/tosource/index.html b/files/zh-cn/web/javascript/reference/global_objects/regexp/tosource/index.html new file mode 100644 index 0000000000..80f4972ca0 --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/regexp/tosource/index.html @@ -0,0 +1,44 @@ +--- +title: RegExp.prototype.toSource() +slug: Web/JavaScript/Reference/Global_Objects/RegExp/toSource +tags: + - JavaScript + - Method + - Non-standard + - Prototype + - RegExp +translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/toSource +--- +<p>{{JSRef("Global_Objects", "RegExp")}}{{ Non-standard_header() }}</p> + +<h2 id="Summary" name="Summary">概述</h2> + +<p>返回一个字符串,代表当前对象的源代码</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox"><code><var>regexObj</var>.toSource() +</code></pre> + +<h2 id="Description" name="Description">描述</h2> + +<p><code>toSource</code>方法返回值如下:</p> + +<ul> + <li>对于内置的<code>RegExp</code>对象, <code>toSource</code> 如下字符串:</li> +</ul> + +<pre class="brush: js">function RegExp() { + [native code] +} +</pre> + +<ul> + <li>对于一个<code>RegExp实例</code>, <code>toSource返回代表该正则的字符串.</code></li> +</ul> + +<p>该方法通常由JavaScript内部隐含调用,而不会明确的出现在用户代码中.</p> + +<h2 id="See_Also" name="See_Also">相关链接</h2> + +<p><a href="/zh-cn/JavaScript/Reference/Global_Objects/Object/toSource" title="zh-cn/JavaScript/Reference/Global_Objects/Object/toSource">Object.prototype.toSource</a></p> |