The default javascript version in browsers

What version of JavaScript uses browsers by default? I read the documentation about the various versions of javascripts supported by Firefox (https://developer.mozilla.org/en/JavaScript). There are many interesting and useful things. Unfortunately, now I am confused which version I can use in development.

+3
source share
3 answers

Unfortunately, knowing that the actual version will not help you, due to a lack / broken implementation.

You better test a method that fears that an older browser might not support, etc.

eg. if support is IE5 and you want to use the Array.push () method, you can do something like:

if(typeof(Array.prototype.push) == 'undefined'){
  Array.prototype.push = function(item){
    var len = this.length;
    this[len] = item;
    return this.length;
  };
}

script - - .

<script language="JavaScript1.2">...</script><!-- BAD -->

<script type="text/javascript">...</script><!-- GOOD -->

<script>...</script><!-- ALSO GOOD -->

XHTML , , XML, script .

<script type="text/javascript">
  <![CDATA[
    //your code here...
  ]]>
</script>
+4

JavaScript (TM) - ECMAScript, Mozilla.

, (SpiderMonkey, Rhino), .

, :

JavaScript 1.5 ECMAScript 3rd Edition Standard, , JS 1.6, 1.7, 1.8 1.9 , , ECMAScript 5th Edition , Mozilla.

+4

Source: https://habr.com/ru/post/1769585/


All Articles