aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/web/javascript/new_in_javascript/1.2/index.html
blob: 3c5db395fcd652cbb2b76c5e8ea5822f1788fa48 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
title: New in JavaScript 1.2
slug: Web/JavaScript/New_in_JavaScript/1.2
translation_of: Archive/Web/JavaScript/New_in_JavaScript/1.2
---
<div>{{jsSidebar("New_in_JS")}}</div>

<p>The following is a changelog for JavaScript from Netscape Navigator 3.0 to 4.0. The old Netscape documentation can be found on <a href="https://web.archive.org/web/19971015223714/http://developer.netscape.com/library/documentation/communicator/jsguide/js1_2.htm">archive.org</a>. Netscape Navigator 4.0 was released on June 11, 1997. Netscape Navigator 4.0 was the third major version of the browser with JavaScript support.</p>

<h2 id="JavaScript_versions">JavaScript versions</h2>

<p>Netscape Navigator 4.0 executes JavaScript language versions up to 1.2. Note that Netscape Navigator 3.0 and earlier ignored scripts with the language attribute set to "JavaScript1.2" and higher.</p>

<pre class="brush: html">&lt;SCRIPT LANGUAGE="JavaScript1.1"&gt; &lt;!-- JavaScript for Navigator 3.0. --&gt;
&lt;SCRIPT LANGUAGE="JavaScript1.2"&gt; &lt;!-- JavaScript for Navigator 4.0. --&gt;</pre>

<h2 id="New_features_in_JavaScript_1.2">New features in JavaScript 1.2</h2>

<h3 id="New_objects">New objects</h3>

<ul>
 <li>You can create objects using literal notation (inspired by dictionary literal syntax from Python 1.x).</li>
 <li>Arrays can now be created using literal notation (inspired by list literal syntax from Python 1.x).</li>
 <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments">arguments</a></li>
</ul>

<h3 id="New_properties">New properties</h3>

<ul>
 <li>{{jsxref("Function.arity")}}</li>
</ul>

<h3 id="New_methods">New methods</h3>

<ul>
 <li>{{jsxref("Array.prototype.concat()")}}</li>
 <li>{{jsxref("Array.prototype.slice()")}}</li>
 <li>{{jsxref("String.prototype.charCodeAt()")}}</li>
 <li>{{jsxref("String.prototype.concat()")}}</li>
 <li>{{jsxref("String.fromCharCode()")}}</li>
 <li>{{jsxref("String.prototype.match()")}}</li>
 <li>{{jsxref("String.prototype.replace()")}}</li>
 <li>{{jsxref("String.prototype.search()")}}</li>
 <li>{{jsxref("String.prototype.slice()")}}</li>
 <li>{{jsxref("String.prototype.substr()")}}</li>
</ul>

<h3 id="New_operators">New operators</h3>

<ul>
 <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/delete"><code>delete</code></a></li>
 <li><a href="/zh-TW/docs/Web/JavaScript/Equality_comparisons_and_when_to_use_them">Equality operators</a> (<code>==</code> and <code>!=</code>)</li>
</ul>

<h3 id="New_statements">New statements</h3>

<ul>
 <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/label">Labeled</a> statements</li>
 <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/switch"><code>switch</code></a></li>
 <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/do...while"><code>do...while</code></a></li>
 <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/import"><code>import</code></a></li>
 <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/export"><code>export</code></a></li>
</ul>

<h3 id="Other_new_features">Other new features</h3>

<ul>
 <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Regular_Expressions">Regular Expressions</a></li>
 <li><a href="https://web.archive.org/web/19971015223714/http://developer.netscape.com/library/documentation/communicator/jsguide/js1_2.htm">Signed scripts</a></li>
</ul>

<h2 id="Changed_functionality_in_JavaScript_1.2">Changed functionality in JavaScript 1.2</h2>

<ul>
 <li>You can now nest functions within functions.</li>
 <li>Number now converts a specified object to a number.</li>
 <li>Number now produces <code>NaN</code> rather than an error if <code>x</code> is a string that does not contain a well-formed numeric literal.</li>
 <li>String now converts a specified object to a string.</li>
 <li>{{jsxref("Array.prototype.sort()")}} now works on all platforms. It no longer converts undefined elements to null and sorts them to the high end of the array.</li>
 <li>{{jsxref("String.prototype.split()")}}
  <ul>
   <li>It can take a regular expression argument, as well as a fixed string, by which to split the object string.</li>
   <li>It can take a limit count so that it won't include trailing empty elements in the resulting array.</li>
  </ul>
 </li>
 <li>{{jsxref("String.prototype.substring()")}}: no longer swaps index numbers when the first index is greater than the second.</li>
 <li><code>toString()</code>: now converts the object or array to a literal.</li>
 <li>The <a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/break"><code>break</code></a> and <a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/continue"><code>continue</code></a> statements can now be used with the new labeled statement.</li>
</ul>