diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:43:23 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:43:23 -0500 |
commit | 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (patch) | |
tree | a9ef8ac1e1b8fe4207b6d64d3841bfb8990b6fd0 /files/vi/web/javascript/reference/global_objects/function/tosource | |
parent | 074785cea106179cb3305637055ab0a009ca74f2 (diff) | |
download | translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.gz translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.bz2 translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.zip |
initial commit
Diffstat (limited to 'files/vi/web/javascript/reference/global_objects/function/tosource')
-rw-r--r-- | files/vi/web/javascript/reference/global_objects/function/tosource/index.html | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/files/vi/web/javascript/reference/global_objects/function/tosource/index.html b/files/vi/web/javascript/reference/global_objects/function/tosource/index.html new file mode 100644 index 0000000000..32a43d0da2 --- /dev/null +++ b/files/vi/web/javascript/reference/global_objects/function/tosource/index.html @@ -0,0 +1,65 @@ +--- +title: Function.prototype.toSource() +slug: Web/JavaScript/Reference/Global_Objects/Function/toSource +translation_of: Web/JavaScript/Reference/Global_Objects/Function/toSource +--- +<div>{{JSRef}} {{non-standard_header}}</div> + +<p>Phương pháp <code><strong>toSource()</strong></code> trả về một chuỗi đại diện cho mã nguồn của đối tượng.</p> + +<h2 id="Cú_pháp">Cú pháp</h2> + +<pre class="syntaxbox"><var>function</var>.toSource(); +</pre> + +<h3 id="Giá_trị_trả_về">Giá trị trả về</h3> + +<p>Một chuỗi đại diện cho mã nguồn của đối tượng.</p> + +<h2 id="Mô_tả">Mô tả</h2> + +<p>Phương pháp <code>toSource</code> trả về các giá trị theo</p> + +<ul> + <li>Đối với đối tượng tích hợp {{jsxref("Function")}}, <code><strong>toSource()</strong></code> trả về chuỗi mã nguồn không khả dụng: + + <pre class="brush: js">function Function() { + [native code] +} +</pre> + </li> + <li>Đối với các hàm tùy chỉnh, <code>toSource()</code> trả về nguồn Javascript định nghĩa đối tượng dưới dạng chuỗi. + <pre class="brush: js">// For example: +function hello() { + console.log("Hello, World!"); +} + +hello.toSource(); +</pre> + + <pre class="brush: js">// Results in: +"function hello() { + console.log(\"Hello, World!\"); +}"</pre> + </li> +</ul> + +<p>Phương pháp này thường được gọi cục bộ trong Javascript và không rõ ràng bằng mã. Bạn có thể gọi <strong><code>toSource()</code></strong> trong khi gỡ lỗi để kiểm tra nội dung của một đối tượng.</p> + +<h2 id="Đặc_điểm_chi_tiết">Đặc điểm chi tiết</h2> + +<p>Không phải là một đặc tính chuẩn nào. Ghi rõ trong JavaScript 1.3.</p> + +<h2 id="Trình_duyệt_tương_thích">Trình duyệt tương thích</h2> + +<div> + + +<p>{{Compat("javascript.builtins.Function.toSource")}}</p> +</div> + +<h2 id="Liên_quan">Liên quan</h2> + +<ul> + <li>{{jsxref("Object.prototype.toSource()")}}</li> +</ul> |