javascript deep introduction

Upload: fa

Post on 06-Jul-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/17/2019 Javascript Deep Introduction

    1/29

    JavaScript From Wikipedia, the free encyclopedia

    (Redirected from Javascript) 

    Not to be confused with Java (programming language), Java (software platform), or  Javanese script. 

    JavaScript

    Paradigm Multi-paradigm: scripting,object-

    oriented  ( prototype-

     based ), imperative,functional[1] 

    Designed by   Brendan Eich 

    Developer   Netscape Communications Corporation, Mozilla

    Foundation, Ecma International 

    First appeared May 23, 1995; 20 years ago

    Stable release   ECMAScript 6[2] / June 17, 2015; 10 months ago

    Typing discipline   dynamic, duck  

    Major implementations 

    Chakra, SpiderMonkey, V8 

    Influenced by

    Lua, Scheme, Perl, Self , Java, C, Python,AWK , HyperTalk  

    Influenced

    ActionScript, AtScript, CoffeeScript, Dart,JScript

    .NET, LiveScript, Objective-J, Opa,Perl 6, QML, TypeScript 

    https://en.wikipedia.org/w/index.php?title=Javascript&redirect=nohttps://en.wikipedia.org/w/index.php?title=Javascript&redirect=nohttps://en.wikipedia.org/w/index.php?title=Javascript&redirect=nohttps://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/Java_(software_platform)https://en.wikipedia.org/wiki/Java_(software_platform)https://en.wikipedia.org/wiki/Java_(software_platform)https://en.wikipedia.org/wiki/Javanese_scripthttps://en.wikipedia.org/wiki/Javanese_scripthttps://en.wikipedia.org/wiki/Javanese_scripthttps://en.wikipedia.org/wiki/Programming_paradigmhttps://en.wikipedia.org/wiki/Multi-paradigmhttps://en.wikipedia.org/wiki/Multi-paradigmhttps://en.wikipedia.org/wiki/Scripting_languagehttps://en.wikipedia.org/wiki/Scripting_languagehttps://en.wikipedia.org/wiki/Object-oriented_programminghttps://en.wikipedia.org/wiki/Object-oriented_programminghttps://en.wikipedia.org/wiki/Object-oriented_programminghttps://en.wikipedia.org/wiki/Object-oriented_programminghttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Imperative_programminghttps://en.wikipedia.org/wiki/Imperative_programminghttps://en.wikipedia.org/wiki/Functional_programminghttps://en.wikipedia.org/wiki/Functional_programminghttps://en.wikipedia.org/wiki/Functional_programminghttps://en.wikipedia.org/wiki/Functional_programminghttps://en.wikipedia.org/wiki/Software_designhttps://en.wikipedia.org/wiki/Software_designhttps://en.wikipedia.org/wiki/Brendan_Eichhttps://en.wikipedia.org/wiki/Brendan_Eichhttps://en.wikipedia.org/wiki/Software_developerhttps://en.wikipedia.org/wiki/Software_developerhttps://en.wikipedia.org/wiki/Netscape_Communications_Corporationhttps://en.wikipedia.org/wiki/Netscape_Communications_Corporationhttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/wiki/Software_release_life_cyclehttps://en.wikipedia.org/wiki/Software_release_life_cyclehttps://en.wikipedia.org/wiki/JavaScript#cite_note-2https://en.wikipedia.org/wiki/JavaScript#cite_note-2https://en.wikipedia.org/wiki/JavaScript#cite_note-2https://en.wikipedia.org/wiki/Type_systemhttps://en.wikipedia.org/wiki/Type_systemhttps://en.wikipedia.org/wiki/Dynamic_typinghttps://en.wikipedia.org/wiki/Dynamic_typinghttps://en.wikipedia.org/wiki/Duck_typinghttps://en.wikipedia.org/wiki/Duck_typinghttps://en.wikipedia.org/wiki/Duck_typinghttps://en.wikipedia.org/wiki/Programming_language_implementationhttps://en.wikipedia.org/wiki/Programming_language_implementationhttps://en.wikipedia.org/wiki/Programming_language_implementationhttps://en.wikipedia.org/wiki/Chakra_(JScript_engine)https://en.wikipedia.org/wiki/Chakra_(JScript_engine)https://en.wikipedia.org/wiki/SpiderMonkey_(JavaScript_engine)https://en.wikipedia.org/wiki/SpiderMonkey_(JavaScript_engine)https://en.wikipedia.org/wiki/SpiderMonkey_(JavaScript_engine)https://en.wikipedia.org/wiki/V8_(JavaScript_engine)https://en.wikipedia.org/wiki/V8_(JavaScript_engine)https://en.wikipedia.org/wiki/V8_(JavaScript_engine)https://en.wikipedia.org/wiki/Lua_(programming_language)https://en.wikipedia.org/wiki/Lua_(programming_language)https://en.wikipedia.org/wiki/Scheme_(programming_language)https://en.wikipedia.org/wiki/Scheme_(programming_language)https://en.wikipedia.org/wiki/Scheme_(programming_language)https://en.wikipedia.org/wiki/Perlhttps://en.wikipedia.org/wiki/Perlhttps://en.wikipedia.org/wiki/Perlhttps://en.wikipedia.org/wiki/Self_(programming_language)https://en.wikipedia.org/wiki/Self_(programming_language)https://en.wikipedia.org/wiki/Self_(programming_language)https://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/Python_(programming_language)https://en.wikipedia.org/wiki/Python_(programming_language)https://en.wikipedia.org/wiki/AWKhttps://en.wikipedia.org/wiki/AWKhttps://en.wikipedia.org/wiki/AWKhttps://en.wikipedia.org/wiki/HyperTalkhttps://en.wikipedia.org/wiki/HyperTalkhttps://en.wikipedia.org/wiki/HyperTalkhttps://en.wikipedia.org/wiki/ActionScripthttps://en.wikipedia.org/wiki/ActionScripthttps://en.wikipedia.org/wiki/AtScripthttps://en.wikipedia.org/wiki/AtScripthttps://en.wikipedia.org/wiki/AtScripthttps://en.wikipedia.org/wiki/CoffeeScripthttps://en.wikipedia.org/wiki/CoffeeScripthttps://en.wikipedia.org/wiki/CoffeeScripthttps://en.wikipedia.org/wiki/Dart_(programming_language)https://en.wikipedia.org/wiki/Dart_(programming_language)https://en.wikipedia.org/wiki/JScript_.NEThttps://en.wikipedia.org/wiki/JScript_.NEThttps://en.wikipedia.org/wiki/JScript_.NEThttps://en.wikipedia.org/wiki/JScript_.NEThttps://en.wikipedia.org/wiki/LiveScripthttps://en.wikipedia.org/wiki/LiveScripthttps://en.wikipedia.org/wiki/LiveScripthttps://en.wikipedia.org/wiki/Objective-Jhttps://en.wikipedia.org/wiki/Objective-Jhttps://en.wikipedia.org/wiki/Objective-Jhttps://en.wikipedia.org/wiki/Opa_(programming_language)https://en.wikipedia.org/wiki/Opa_(programming_language)https://en.wikipedia.org/wiki/Perl_6https://en.wikipedia.org/wiki/Perl_6https://en.wikipedia.org/wiki/Perl_6https://en.wikipedia.org/wiki/QMLhttps://en.wikipedia.org/wiki/QMLhttps://en.wikipedia.org/wiki/QMLhttps://en.wikipedia.org/wiki/TypeScripthttps://en.wikipedia.org/wiki/TypeScripthttps://en.wikipedia.org/wiki/TypeScripthttps://en.wikipedia.org/wiki/TypeScripthttps://en.wikipedia.org/wiki/QMLhttps://en.wikipedia.org/wiki/Perl_6https://en.wikipedia.org/wiki/Opa_(programming_language)https://en.wikipedia.org/wiki/Objective-Jhttps://en.wikipedia.org/wiki/LiveScripthttps://en.wikipedia.org/wiki/JScript_.NEThttps://en.wikipedia.org/wiki/JScript_.NEThttps://en.wikipedia.org/wiki/Dart_(programming_language)https://en.wikipedia.org/wiki/CoffeeScripthttps://en.wikipedia.org/wiki/AtScripthttps://en.wikipedia.org/wiki/ActionScripthttps://en.wikipedia.org/wiki/HyperTalkhttps://en.wikipedia.org/wiki/AWKhttps://en.wikipedia.org/wiki/Python_(programming_language)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/Self_(programming_language)https://en.wikipedia.org/wiki/Perlhttps://en.wikipedia.org/wiki/Scheme_(programming_language)https://en.wikipedia.org/wiki/Lua_(programming_language)https://en.wikipedia.org/wiki/V8_(JavaScript_engine)https://en.wikipedia.org/wiki/SpiderMonkey_(JavaScript_engine)https://en.wikipedia.org/wiki/Chakra_(JScript_engine)https://en.wikipedia.org/wiki/Programming_language_implementationhttps://en.wikipedia.org/wiki/Duck_typinghttps://en.wikipedia.org/wiki/Dynamic_typinghttps://en.wikipedia.org/wiki/Type_systemhttps://en.wikipedia.org/wiki/JavaScript#cite_note-2https://en.wikipedia.org/wiki/Software_release_life_cyclehttps://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Netscape_Communications_Corporationhttps://en.wikipedia.org/wiki/Software_developerhttps://en.wikipedia.org/wiki/Brendan_Eichhttps://en.wikipedia.org/wiki/Software_designhttps://en.wikipedia.org/wiki/Functional_programminghttps://en.wikipedia.org/wiki/Functional_programminghttps://en.wikipedia.org/wiki/Imperative_programminghttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Object-oriented_programminghttps://en.wikipedia.org/wiki/Object-oriented_programminghttps://en.wikipedia.org/wiki/Scripting_languagehttps://en.wikipedia.org/wiki/Multi-paradigmhttps://en.wikipedia.org/wiki/Programming_paradigmhttps://en.wikipedia.org/wiki/Javanese_scripthttps://en.wikipedia.org/wiki/Java_(software_platform)https://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/w/index.php?title=Javascript&redirect=no

  • 8/17/2019 Javascript Deep Introduction

    2/29

      JavaScript at Wikibooks

    JavaScript

    Filename extension  .js  

    Internet

    media type  

    application/javascript  

    text/javascript (obsolete)[3]  

    Uniform Type

    Identifier (UTI)  

    com.netscape.javascript-source[4] 

    Type of format Scripting language 

    Part of a series on

    JavaScript

      JavaScript syntax 

      JavaScript library 

      Unobtrusive JavaScript 

      JavaScript engine 

    Lists of Frameworks and Libraries

      Ajax frameworks   JavaScript web frameworks 

    Comparison of JavaScript frameworks 

      List of JavaScript libraries 

    JavaScript unit testing frameworks 

    JavaScript Object Notation  

    See also 

      ECMAScript 

      v 

      t 

      e 

    JavaScript  (/ˈdʒɑːvəˌskrɪpt/ [5]) is a high-level, dynamic, untyped, and interpreted programminglanguage.[6] It has been standardized in the ECMAScript languagespecification.[7]  Alongside HTML and CSS, it is one of the three core technologies of  World Wide

    https://en.wikibooks.org/wiki/JavaScripthttps://en.wikibooks.org/wiki/JavaScripthttps://en.wikipedia.org/wiki/Filename_extensionhttps://en.wikipedia.org/wiki/Filename_extensionhttps://en.wikipedia.org/wiki/Internet_media_typehttps://en.wikipedia.org/wiki/Internet_media_typehttps://en.wikipedia.org/wiki/Internet_media_typehttps://en.wikipedia.org/wiki/JavaScript#cite_note-3https://en.wikipedia.org/wiki/Uniform_Type_Identifierhttps://en.wikipedia.org/wiki/Uniform_Type_Identifierhttps://en.wikipedia.org/wiki/Uniform_Type_Identifierhttps://en.wikipedia.org/wiki/JavaScript#cite_note-4https://en.wikipedia.org/wiki/JavaScript#cite_note-4https://en.wikipedia.org/wiki/JavaScript#cite_note-4https://en.wikipedia.org/wiki/Scripting_languagehttps://en.wikipedia.org/wiki/Scripting_languagehttps://en.wikipedia.org/wiki/Category:JavaScripthttps://en.wikipedia.org/wiki/Category:JavaScripthttps://en.wikipedia.org/wiki/Category:JavaScripthttps://en.wikipedia.org/wiki/JavaScript_syntaxhttps://en.wikipedia.org/wiki/JavaScript_syntaxhttps://en.wikipedia.org/wiki/JavaScript_libraryhttps://en.wikipedia.org/wiki/JavaScript_libraryhttps://en.wikipedia.org/wiki/Unobtrusive_JavaScripthttps://en.wikipedia.org/wiki/Unobtrusive_JavaScripthttps://en.wikipedia.org/wiki/JavaScript_enginehttps://en.wikipedia.org/wiki/JavaScript_enginehttps://en.wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScripthttps://en.wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScripthttps://en.wikipedia.org/wiki/Comparison_of_web_frameworks#JavaScripthttps://en.wikipedia.org/wiki/Comparison_of_web_frameworks#JavaScripthttps://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworkshttps://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworkshttps://en.wikipedia.org/wiki/List_of_JavaScript_librarieshttps://en.wikipedia.org/wiki/List_of_JavaScript_librarieshttps://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#JavaScripthttps://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#JavaScripthttps://en.wikipedia.org/wiki/JSONhttps://en.wikipedia.org/wiki/JSONhttps://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/Template:JavaScriptSidebarhttps://en.wikipedia.org/wiki/Template:JavaScriptSidebarhttps://en.wikipedia.org/wiki/Template_talk:JavaScriptSidebarhttps://en.wikipedia.org/wiki/Template_talk:JavaScriptSidebarhttps://en.wikipedia.org/w/index.php?title=Template:JavaScriptSidebar&action=edithttps://en.wikipedia.org/w/index.php?title=Template:JavaScriptSidebar&action=edithttps://en.wikipedia.org/wiki/Help:IPA_for_Englishhttps://en.wikipedia.org/wiki/Help:IPA_for_Englishhttps://en.wikipedia.org/wiki/Help:IPA_for_Englishhttps://en.wikipedia.org/wiki/Help:IPA_for_Englishhttps://en.wikipedia.org/wiki/High-level_programming_languagehttps://en.wikipedia.org/wiki/High-level_programming_languagehttps://en.wikipedia.org/wiki/High-level_programming_languagehttps://en.wikipedia.org/wiki/Dynamic_programming_languagehttps://en.wikipedia.org/wiki/Dynamic_programming_languagehttps://en.wikipedia.org/wiki/Dynamic_programming_languagehttps://en.wikipedia.org/wiki/Programming_language#Type_systemhttps://en.wikipedia.org/wiki/Programming_language#Type_systemhttps://en.wikipedia.org/wiki/Programming_language#Type_systemhttps://en.wikipedia.org/wiki/Interpreted_languagehttps://en.wikipedia.org/wiki/Interpreted_languagehttps://en.wikipedia.org/wiki/Interpreted_languagehttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20112-7https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20112-7https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20112-7https://en.wikipedia.org/wiki/HTMLhttps://en.wikipedia.org/wiki/HTMLhttps://en.wikipedia.org/wiki/HTMLhttps://en.wikipedia.org/wiki/CSShttps://en.wikipedia.org/wiki/CSShttps://en.wikipedia.org/wiki/CSShttps://en.wikipedia.org/wiki/World_Wide_Webhttps://en.wikipedia.org/wiki/World_Wide_Webhttps://en.wikipedia.org/wiki/World_Wide_Webhttps://en.wikipedia.org/wiki/CSShttps://en.wikipedia.org/wiki/HTMLhttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20112-7https://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/Interpreted_languagehttps://en.wikipedia.org/wiki/Programming_language#Type_systemhttps://en.wikipedia.org/wiki/Dynamic_programming_languagehttps://en.wikipedia.org/wiki/High-level_programming_languagehttps://en.wikipedia.org/wiki/Help:IPA_for_Englishhttps://en.wikipedia.org/wiki/Help:IPA_for_Englishhttps://en.wikipedia.org/w/index.php?title=Template:JavaScriptSidebar&action=edithttps://en.wikipedia.org/wiki/Template_talk:JavaScriptSidebarhttps://en.wikipedia.org/wiki/Template:JavaScriptSidebarhttps://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/JSONhttps://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#JavaScripthttps://en.wikipedia.org/wiki/List_of_JavaScript_librarieshttps://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworkshttps://en.wikipedia.org/wiki/Comparison_of_web_frameworks#JavaScripthttps://en.wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScripthttps://en.wikipedia.org/wiki/JavaScript_enginehttps://en.wikipedia.org/wiki/Unobtrusive_JavaScripthttps://en.wikipedia.org/wiki/JavaScript_libraryhttps://en.wikipedia.org/wiki/JavaScript_syntaxhttps://en.wikipedia.org/wiki/Category:JavaScripthttps://en.wikipedia.org/wiki/Scripting_languagehttps://en.wikipedia.org/wiki/JavaScript#cite_note-4https://en.wikipedia.org/wiki/Uniform_Type_Identifierhttps://en.wikipedia.org/wiki/Uniform_Type_Identifierhttps://en.wikipedia.org/wiki/JavaScript#cite_note-3https://en.wikipedia.org/wiki/Internet_media_typehttps://en.wikipedia.org/wiki/Internet_media_typehttps://en.wikipedia.org/wiki/Filename_extensionhttps://en.wikibooks.org/wiki/JavaScript

  • 8/17/2019 Javascript Deep Introduction

    3/29

    Webcontent production; the majority of  websites employ it and it is supported by all modern Webbrowsers without plug-ins.[6] JavaScript isprototype-based with first-class functions, making it a multi-paradigm language, supporting object-oriented,[8] imperative, and functionalprogramming styles.[6] Ithas an  API for working with text, arrays, dates and regular expressions, but does not includeany I/O, such as networking, storage, or graphics facilities, relying for these upon the hostenvironment in which it is embedded.[7] 

    Despite some naming, syntactic, and standard library similarities, JavaScript and Java are otherwiseunrelated and have very differentsemantics. The syntax of JavaScript is actually derived from C, while the semantics and design are influenced by the Self  and Schemeprogramming languages.[9] 

    JavaScript is also used in environments that are not Web-based, such as PDF documents, site-specific browsers, and desktop widgets. Newer and faster JavaScript virtual machines (VMs) andplatforms built upon them have also increased the popularity of JavaScript for server-side Webapplications. On the client side, JavaScript has been traditionally implemented asan interpreted language, but more recent browsers perform  just-in-time compilation. It is also used ingame development, the creation of desktop and mobile applications, and server-side networkprogramming with runtime environments such as Node.js. 

    Contents

    [hide] 

      1History 

    o  1.1Beginnings at Netscape 

    o  1.2Server-side JavaScript 

    o  1.3Adoption by Microsoft 

    o  1.4Standardization 

    o  1.5Later developments 

      2Trademark 

      3Features 

    o  3.1Imperative and structured 

    o  3.2Dynamic 

    o  3.3Prototype-based (Object-oriented) 

    o  3.4Functional 

    o  3.5Delegative 

    o  3.6Miscellaneous 

    o  3.7Vendor-specific extensions 

      4Syntax 

    o  4.1Simple examples 

    o  4.2More advanced example 

      5Use in Web pages 

    o  5.1Example script 

    o  5.2Compatibility considerations 

      6Security o  6.1Cross-site vulnerabilities 

      6.1.1Misplaced trust in the client 

      6.1.2Browser and plugin coding errors 

      6.1.3Sandbox implementation errors 

      7Uses outside Web pages 

    o  7.1Embedded scripting language 

    o  7.2Scripting engine 

    o  7.3Application platform 

    https://en.wikipedia.org/wiki/World_Wide_Webhttps://en.wikipedia.org/wiki/Websitehttps://en.wikipedia.org/wiki/Websitehttps://en.wikipedia.org/wiki/Websitehttps://en.wikipedia.org/wiki/Web_browserhttps://en.wikipedia.org/wiki/Web_browserhttps://en.wikipedia.org/wiki/Web_browserhttps://en.wikipedia.org/wiki/Web_browserhttps://en.wikipedia.org/wiki/Browser_extensionhttps://en.wikipedia.org/wiki/Browser_extensionhttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/First-class_functionhttps://en.wikipedia.org/wiki/First-class_functionhttps://en.wikipedia.org/wiki/First-class_functionhttps://en.wikipedia.org/wiki/Multi-paradigmhttps://en.wikipedia.org/wiki/Multi-paradigmhttps://en.wikipedia.org/wiki/Multi-paradigmhttps://en.wikipedia.org/wiki/Multi-paradigmhttps://en.wikipedia.org/wiki/Object-oriented_programminghttps://en.wikipedia.org/wiki/Object-oriented_programminghttps://en.wikipedia.org/wiki/JavaScript#cite_note-ECMA-262-8https://en.wikipedia.org/wiki/JavaScript#cite_note-ECMA-262-8https://en.wikipedia.org/wiki/Imperative_programminghttps://en.wikipedia.org/wiki/Imperative_programminghttps://en.wikipedia.org/wiki/Imperative_programminghttps://en.wikipedia.org/wiki/Functional_programminghttps://en.wikipedia.org/wiki/Functional_programminghttps://en.wikipedia.org/wiki/Functional_programminghttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/Application_programming_interfacehttps://en.wikipedia.org/wiki/Application_programming_interfacehttps://en.wikipedia.org/wiki/Application_programming_interfacehttps://en.wikipedia.org/wiki/Array_data_typehttps://en.wikipedia.org/wiki/Array_data_typehttps://en.wikipedia.org/wiki/Array_data_typehttps://en.wikipedia.org/wiki/Regular_expressionhttps://en.wikipedia.org/wiki/Regular_expressionhttps://en.wikipedia.org/wiki/Regular_expressionhttps://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20112-7https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20112-7https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20112-7https://en.wikipedia.org/wiki/Syntax_(programming_languages)https://en.wikipedia.org/wiki/Syntax_(programming_languages)https://en.wikipedia.org/wiki/Syntax_(programming_languages)https://en.wikipedia.org/wiki/Standard_libraryhttps://en.wikipedia.org/wiki/Standard_libraryhttps://en.wikipedia.org/wiki/Standard_libraryhttps://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/Semantics_(computer_science)https://en.wikipedia.org/wiki/Semantics_(computer_science)https://en.wikipedia.org/wiki/Semantics_(computer_science)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/Self_(programming_language)https://en.wikipedia.org/wiki/Self_(programming_language)https://en.wikipedia.org/wiki/Self_(programming_language)https://en.wikipedia.org/wiki/Scheme_(programming_language)https://en.wikipedia.org/wiki/Scheme_(programming_language)https://en.wikipedia.org/wiki/JavaScript#cite_note-9https://en.wikipedia.org/wiki/JavaScript#cite_note-9https://en.wikipedia.org/wiki/JavaScript#cite_note-9https://en.wikipedia.org/wiki/Portable_Document_Formathttps://en.wikipedia.org/wiki/Portable_Document_Formathttps://en.wikipedia.org/wiki/Portable_Document_Formathttps://en.wikipedia.org/wiki/Site-specific_browserhttps://en.wikipedia.org/wiki/Site-specific_browserhttps://en.wikipedia.org/wiki/Site-specific_browserhttps://en.wikipedia.org/wiki/Site-specific_browserhttps://en.wikipedia.org/wiki/Desktop_widgethttps://en.wikipedia.org/wiki/Desktop_widgethttps://en.wikipedia.org/wiki/Desktop_widgethttps://en.wikipedia.org/wiki/Virtual_machinehttps://en.wikipedia.org/wiki/Virtual_machinehttps://en.wikipedia.org/wiki/Virtual_machinehttps://en.wikipedia.org/wiki/Web_applicationhttps://en.wikipedia.org/wiki/Web_applicationhttps://en.wikipedia.org/wiki/Web_applicationhttps://en.wikipedia.org/wiki/Web_applicationhttps://en.wikipedia.org/wiki/Interpreter_(computing)https://en.wikipedia.org/wiki/Interpreter_(computing)https://en.wikipedia.org/wiki/Interpreter_(computing)https://en.wikipedia.org/wiki/Just-in-time_compilationhttps://en.wikipedia.org/wiki/Just-in-time_compilationhttps://en.wikipedia.org/wiki/Just-in-time_compilationhttps://en.wikipedia.org/wiki/Node.jshttps://en.wikipedia.org/wiki/Node.jshttps://en.wikipedia.org/wiki/Node.jshttps://en.wikipedia.org/wiki/JavaScripthttps://en.wikipedia.org/wiki/JavaScripthttps://en.wikipedia.org/wiki/JavaScripthttps://en.wikipedia.org/wiki/JavaScript#Historyhttps://en.wikipedia.org/wiki/JavaScript#Historyhttps://en.wikipedia.org/wiki/JavaScript#Beginnings_at_Netscapehttps://en.wikipedia.org/wiki/JavaScript#Beginnings_at_Netscapehttps://en.wikipedia.org/wiki/JavaScript#Server-side_JavaScripthttps://en.wikipedia.org/wiki/JavaScript#Server-side_JavaScripthttps://en.wikipedia.org/wiki/JavaScript#Adoption_by_Microsofthttps://en.wikipedia.org/wiki/JavaScript#Adoption_by_Microsofthttps://en.wikipedia.org/wiki/JavaScript#Standardizationhttps://en.wikipedia.org/wiki/JavaScript#Standardizationhttps://en.wikipedia.org/wiki/JavaScript#Later_developmentshttps://en.wikipedia.org/wiki/JavaScript#Later_developmentshttps://en.wikipedia.org/wiki/JavaScript#Trademarkhttps://en.wikipedia.org/wiki/JavaScript#Trademarkhttps://en.wikipedia.org/wiki/JavaScript#Featureshttps://en.wikipedia.org/wiki/JavaScript#Featureshttps://en.wikipedia.org/wiki/JavaScript#Imperative_and_structuredhttps://en.wikipedia.org/wiki/JavaScript#Imperative_and_structuredhttps://en.wikipedia.org/wiki/JavaScript#Dynamichttps://en.wikipedia.org/wiki/JavaScript#Dynamichttps://en.wikipedia.org/wiki/JavaScript#Prototype-based_.28Object-oriented.29https://en.wikipedia.org/wiki/JavaScript#Prototype-based_.28Object-oriented.29https://en.wikipedia.org/wiki/JavaScript#Functionalhttps://en.wikipedia.org/wiki/JavaScript#Functionalhttps://en.wikipedia.org/wiki/JavaScript#Delegativehttps://en.wikipedia.org/wiki/JavaScript#Delegativehttps://en.wikipedia.org/wiki/JavaScript#Miscellaneoushttps://en.wikipedia.org/wiki/JavaScript#Miscellaneoushttps://en.wikipedia.org/wiki/JavaScript#Vendor-specific_extensionshttps://en.wikipedia.org/wiki/JavaScript#Vendor-specific_extensionshttps://en.wikipedia.org/wiki/JavaScript#Syntaxhttps://en.wikipedia.org/wiki/JavaScript#Syntaxhttps://en.wikipedia.org/wiki/JavaScript#Simple_exampleshttps://en.wikipedia.org/wiki/JavaScript#Simple_exampleshttps://en.wikipedia.org/wiki/JavaScript#More_advanced_examplehttps://en.wikipedia.org/wiki/JavaScript#More_advanced_examplehttps://en.wikipedia.org/wiki/JavaScript#Use_in_Web_pageshttps://en.wikipedia.org/wiki/JavaScript#Use_in_Web_pageshttps://en.wikipedia.org/wiki/JavaScript#Example_scripthttps://en.wikipedia.org/wiki/JavaScript#Example_scripthttps://en.wikipedia.org/wiki/JavaScript#Compatibility_considerationshttps://en.wikipedia.org/wiki/JavaScript#Compatibility_considerationshttps://en.wikipedia.org/wiki/JavaScript#Securityhttps://en.wikipedia.org/wiki/JavaScript#Securityhttps://en.wikipedia.org/wiki/JavaScript#Cross-site_vulnerabilitieshttps://en.wikipedia.org/wiki/JavaScript#Cross-site_vulnerabilitieshttps://en.wikipedia.org/wiki/JavaScript#Misplaced_trust_in_the_clienthttps://en.wikipedia.org/wiki/JavaScript#Misplaced_trust_in_the_clienthttps://en.wikipedia.org/wiki/JavaScript#Browser_and_plugin_coding_errorshttps://en.wikipedia.org/wiki/JavaScript#Browser_and_plugin_coding_errorshttps://en.wikipedia.org/wiki/JavaScript#Sandbox_implementation_errorshttps://en.wikipedia.org/wiki/JavaScript#Sandbox_implementation_errorshttps://en.wikipedia.org/wiki/JavaScript#Uses_outside_Web_pageshttps://en.wikipedia.org/wiki/JavaScript#Uses_outside_Web_pageshttps://en.wikipedia.org/wiki/JavaScript#Embedded_scripting_languagehttps://en.wikipedia.org/wiki/JavaScript#Embedded_scripting_languagehttps://en.wikipedia.org/wiki/JavaScript#Scripting_enginehttps://en.wikipedia.org/wiki/JavaScript#Scripting_enginehttps://en.wikipedia.org/wiki/JavaScript#Application_platformhttps://en.wikipedia.org/wiki/JavaScript#Application_platformhttps://en.wikipedia.org/wiki/JavaScript#Application_platformhttps://en.wikipedia.org/wiki/JavaScript#Scripting_enginehttps://en.wikipedia.org/wiki/JavaScript#Embedded_scripting_languagehttps://en.wikipedia.org/wiki/JavaScript#Uses_outside_Web_pageshttps://en.wikipedia.org/wiki/JavaScript#Sandbox_implementation_errorshttps://en.wikipedia.org/wiki/JavaScript#Browser_and_plugin_coding_errorshttps://en.wikipedia.org/wiki/JavaScript#Misplaced_trust_in_the_clienthttps://en.wikipedia.org/wiki/JavaScript#Cross-site_vulnerabilitieshttps://en.wikipedia.org/wiki/JavaScript#Securityhttps://en.wikipedia.org/wiki/JavaScript#Compatibility_considerationshttps://en.wikipedia.org/wiki/JavaScript#Example_scripthttps://en.wikipedia.org/wiki/JavaScript#Use_in_Web_pageshttps://en.wikipedia.org/wiki/JavaScript#More_advanced_examplehttps://en.wikipedia.org/wiki/JavaScript#Simple_exampleshttps://en.wikipedia.org/wiki/JavaScript#Syntaxhttps://en.wikipedia.org/wiki/JavaScript#Vendor-specific_extensionshttps://en.wikipedia.org/wiki/JavaScript#Miscellaneoushttps://en.wikipedia.org/wiki/JavaScript#Delegativehttps://en.wikipedia.org/wiki/JavaScript#Functionalhttps://en.wikipedia.org/wiki/JavaScript#Prototype-based_.28Object-oriented.29https://en.wikipedia.org/wiki/JavaScript#Dynamichttps://en.wikipedia.org/wiki/JavaScript#Imperative_and_structuredhttps://en.wikipedia.org/wiki/JavaScript#Featureshttps://en.wikipedia.org/wiki/JavaScript#Trademarkhttps://en.wikipedia.org/wiki/JavaScript#Later_developmentshttps://en.wikipedia.org/wiki/JavaScript#Standardizationhttps://en.wikipedia.org/wiki/JavaScript#Adoption_by_Microsofthttps://en.wikipedia.org/wiki/JavaScript#Server-side_JavaScripthttps://en.wikipedia.org/wiki/JavaScript#Beginnings_at_Netscapehttps://en.wikipedia.org/wiki/JavaScript#Historyhttps://en.wikipedia.org/wiki/JavaScripthttps://en.wikipedia.org/wiki/Node.jshttps://en.wikipedia.org/wiki/Just-in-time_compilationhttps://en.wikipedia.org/wiki/Interpreter_(computing)https://en.wikipedia.org/wiki/Web_applicationhttps://en.wikipedia.org/wiki/Web_applicationhttps://en.wikipedia.org/wiki/Virtual_machinehttps://en.wikipedia.org/wiki/Desktop_widgethttps://en.wikipedia.org/wiki/Site-specific_browserhttps://en.wikipedia.org/wiki/Site-specific_browserhttps://en.wikipedia.org/wiki/Portable_Document_Formathttps://en.wikipedia.org/wiki/JavaScript#cite_note-9https://en.wikipedia.org/wiki/Scheme_(programming_language)https://en.wikipedia.org/wiki/Self_(programming_language)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/Semantics_(computer_science)https://en.wikipedia.org/wiki/Java_(programming_language)https://en.wikipedia.org/wiki/Standard_libraryhttps://en.wikipedia.org/wiki/Syntax_(programming_languages)https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20112-7https://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/Regular_expressionhttps://en.wikipedia.org/wiki/Array_data_typehttps://en.wikipedia.org/wiki/Application_programming_interfacehttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/Functional_programminghttps://en.wikipedia.org/wiki/Imperative_programminghttps://en.wikipedia.org/wiki/JavaScript#cite_note-ECMA-262-8https://en.wikipedia.org/wiki/Object-oriented_programminghttps://en.wikipedia.org/wiki/Multi-paradigmhttps://en.wikipedia.org/wiki/Multi-paradigmhttps://en.wikipedia.org/wiki/First-class_functionhttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan20111-6https://en.wikipedia.org/wiki/Browser_extensionhttps://en.wikipedia.org/wiki/Web_browserhttps://en.wikipedia.org/wiki/Web_browserhttps://en.wikipedia.org/wiki/Websitehttps://en.wikipedia.org/wiki/World_Wide_Web

  • 8/17/2019 Javascript Deep Introduction

    4/29

      8Development tools 

      9Version history 

      10Related languages and features 

    o  10.1Use as an intermediate language 

    o  10.2JavaScript and Java 

      11References 

      12Further reading 

      13External links 

    History [edit] Beginnings at Netscape[edit] 

    JavaScript was originally developed in 10 days in May 1995 by Brendan Eich, while he was workingfor  Netscape Communications Corporation. Indeed, while competing withMicrosoft for user adoptionof Web technologies and platforms, Netscape considered their client-server offering a distributed OSwith a portable version of  Sun Microsystems's Java providing an environment in which applets couldbe run.[citation needed] Because Java was a competitor of  C++ and aimed at professional programmers,Netscape also wanted a lightweight interpreted language that would complement Java by appealingto nonprofessional programmers, like Microsoft's Visual Basic (see JavaScript and Java).[10] 

     Although it was developed under the name Mocha, the language was officiallycalled LiveScript when it first shipped in beta releases of Netscape Navigator 2.0 in September1995, but it was renamed JavaScript[11] when it was deployed in the Netscape browser version2.0B3.[12] 

    The change of name from LiveScript to JavaScript roughly coincided with Netscape adding supportfor Java technology in its Netscape Navigator  Web browser. The final choice of name causedconfusion, giving the impression that the language was a spin-off of the Java programminglanguage, and the choice has been characterized as a marketing ploy by Netscape to giveJavaScript the cachet of what was then the hot new Web programming language .[13][14] 

    There is a common misconception that the JavaScript language was influenced by an earlier Web

    page scripting language developed by Nombas named C-- (not to be confused with the later  C-- created in 1997).[15][16][17] Brendan Eich, however, had never heard of C-- before he createdLiveScript.[18] Nombas did pitch their embedded Web page scripting to Netscape, though Web pagescripting was not a new concept, as shown by ViolaWWW.[19] Nombas later switched to offeringJavaScript instead of C-- in their ScriptEase product and was part of the TC39 group thatstandardized ECMAScript.[20][21] 

    Server-side JavaScript [edit] 

    Netscape introduced an implementation of the language for  server-side scripting with NetscapeEnterprise Server  in December, 1995, soon after releasing JavaScript for browsers.[22][23] Since themid-2000s, there has been a resurgence of  server-side JavaScript implementations, suchas Node.js.[24][25] 

     Adopt ion by Microsof t[edit] 

    Microsoft Windows script technologies including VBScript and JScript were released in 1996.JScript, a reverse-engineered implementation of Netscape's JavaScript, was released on July 16,1996 and was part of  Internet Explorer 3, as well as being available server-side in InternetInformation Server . IE3 also included Microsoft's first support for  Cascading Style Sheets andvarious extensions to HTML, but in each case the implementation was noticeably different to thatfound in Netscape Navigator  at the time.[26][27] These differences made it difficult for designers andprogrammers to make a single website work well in both browsers leading to the use of 'best viewed

    https://en.wikipedia.org/wiki/JavaScript#Development_toolshttps://en.wikipedia.org/wiki/JavaScript#Development_toolshttps://en.wikipedia.org/wiki/JavaScript#Version_historyhttps://en.wikipedia.org/wiki/JavaScript#Version_historyhttps://en.wikipedia.org/wiki/JavaScript#Related_languages_and_featureshttps://en.wikipedia.org/wiki/JavaScript#Related_languages_and_featureshttps://en.wikipedia.org/wiki/JavaScript#Use_as_an_intermediate_languagehttps://en.wikipedia.org/wiki/JavaScript#Use_as_an_intermediate_languagehttps://en.wikipedia.org/wiki/JavaScript#JavaScript_and_Javahttps://en.wikipedia.org/wiki/JavaScript#JavaScript_and_Javahttps://en.wikipedia.org/wiki/JavaScript#Referenceshttps://en.wikipedia.org/wiki/JavaScript#Referenceshttps://en.wikipedia.org/wiki/JavaScript#Further_readinghttps://en.wikipedia.org/wiki/JavaScript#Further_readinghttps://en.wikipedia.org/wiki/JavaScript#External_linkshttps://en.wikipedia.org/wiki/JavaScript#External_linkshttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=1https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=1https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=1https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=2https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=2https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=2https://en.wikipedia.org/wiki/Brendan_Eichhttps://en.wikipedia.org/wiki/Brendan_Eichhttps://en.wikipedia.org/wiki/Brendan_Eichhttps://en.wikipedia.org/wiki/Netscape_Communications_Corporationhttps://en.wikipedia.org/wiki/Netscape_Communications_Corporationhttps://en.wikipedia.org/wiki/Netscape_Communications_Corporationhttps://en.wikipedia.org/wiki/Microsofthttps://en.wikipedia.org/wiki/Microsofthttps://en.wikipedia.org/wiki/Microsofthttps://en.wikipedia.org/wiki/Sun_Microsystemshttps://en.wikipedia.org/wiki/Sun_Microsystemshttps://en.wikipedia.org/wiki/Sun_Microsystemshttps://en.wikipedia.org/wiki/Java_applethttps://en.wikipedia.org/wiki/Java_applethttps://en.wikipedia.org/wiki/Java_applethttps://en.wikipedia.org/wiki/Wikipedia:Citation_neededhttps://en.wikipedia.org/wiki/Wikipedia:Citation_neededhttps://en.wikipedia.org/wiki/Wikipedia:Citation_neededhttps://en.wikipedia.org/wiki/Wikipedia:Citation_neededhttps://en.wikipedia.org/wiki/C%2B%2Bhttps://en.wikipedia.org/wiki/C%2B%2Bhttps://en.wikipedia.org/wiki/C%2B%2Bhttps://en.wikipedia.org/wiki/Interpreted_languagehttps://en.wikipedia.org/wiki/Interpreted_languagehttps://en.wikipedia.org/wiki/Interpreted_languagehttps://en.wikipedia.org/wiki/JavaScript#JavaScript_and_Javahttps://en.wikipedia.org/wiki/JavaScript#JavaScript_and_Javahttps://en.wikipedia.org/wiki/JavaScript#JavaScript_and_Javahttps://en.wikipedia.org/wiki/JavaScript#cite_note-10https://en.wikipedia.org/wiki/JavaScript#cite_note-10https://en.wikipedia.org/wiki/JavaScript#cite_note-10https://en.wikipedia.org/wiki/JavaScript#cite_note-11https://en.wikipedia.org/wiki/JavaScript#cite_note-11https://en.wikipedia.org/wiki/JavaScript#cite_note-11https://en.wikipedia.org/wiki/JavaScript#cite_note-techvision-12https://en.wikipedia.org/wiki/JavaScript#cite_note-techvision-12https://en.wikipedia.org/wiki/JavaScript#cite_note-techvision-12https://en.wikipedia.org/wiki/Netscape_Navigatorhttps://en.wikipedia.org/wiki/Netscape_Navigatorhttps://en.wikipedia.org/wiki/Netscape_Navigatorhttps://en.wikipedia.org/wiki/JavaScript#cite_note-13https://en.wikipedia.org/wiki/JavaScript#cite_note-13https://en.wikipedia.org/wiki/JavaScript#cite_note-13https://en.wikipedia.org/wiki/Openwavehttps://en.wikipedia.org/wiki/Openwavehttps://en.wikipedia.org/wiki/Openwavehttps://en.wikipedia.org/wiki/C--https://en.wikipedia.org/wiki/C--https://en.wikipedia.org/wiki/C--https://en.wikipedia.org/wiki/C--https://en.wikipedia.org/wiki/JavaScript#cite_note-15https://en.wikipedia.org/wiki/JavaScript#cite_note-15https://en.wikipedia.org/wiki/JavaScript#cite_note-17https://en.wikipedia.org/wiki/JavaScript#cite_note-17https://en.wikipedia.org/wiki/JavaScript#cite_note-18https://en.wikipedia.org/wiki/JavaScript#cite_note-18https://en.wikipedia.org/wiki/JavaScript#cite_note-18https://en.wikipedia.org/wiki/ViolaWWWhttps://en.wikipedia.org/wiki/ViolaWWWhttps://en.wikipedia.org/wiki/JavaScript#cite_note-19https://en.wikipedia.org/wiki/JavaScript#cite_note-19https://en.wikipedia.org/wiki/JavaScript#cite_note-19https://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/JavaScript#cite_note-20https://en.wikipedia.org/wiki/JavaScript#cite_note-20https://en.wikipedia.org/wiki/JavaScript#cite_note-20https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=3https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=3https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=3https://en.wikipedia.org/wiki/Server-side_scriptinghttps://en.wikipedia.org/wiki/Server-side_scriptinghttps://en.wikipedia.org/wiki/Server-side_scriptinghttps://en.wikipedia.org/wiki/Netscape_Enterprise_Serverhttps://en.wikipedia.org/wiki/Netscape_Enterprise_Serverhttps://en.wikipedia.org/wiki/Netscape_Enterprise_Serverhttps://en.wikipedia.org/wiki/Netscape_Enterprise_Serverhttps://en.wikipedia.org/wiki/JavaScript#cite_note-Newscape_JavaScript_Guide-1998-22https://en.wikipedia.org/wiki/JavaScript#cite_note-Newscape_JavaScript_Guide-1998-22https://en.wikipedia.org/wiki/JavaScript#cite_note-Newscape_JavaScript_Guide-1998-22https://en.wikipedia.org/wiki/Comparison_of_server-side_JavaScript_solutionshttps://en.wikipedia.org/wiki/Comparison_of_server-side_JavaScript_solutionshttps://en.wikipedia.org/wiki/Comparison_of_server-side_JavaScript_solutionshttps://en.wikipedia.org/wiki/Node.jshttps://en.wikipedia.org/wiki/Node.jshttps://en.wikipedia.org/wiki/JavaScript#cite_note-RWW-Server-Side-2009-12-17-24https://en.wikipedia.org/wiki/JavaScript#cite_note-RWW-Server-Side-2009-12-17-24https://en.wikipedia.org/wiki/JavaScript#cite_note-RWW-Server-Side-2009-12-17-24https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=4https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=4https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=4https://en.wikipedia.org/wiki/Microsoft_Windowshttps://en.wikipedia.org/wiki/Microsoft_Windowshttps://en.wikipedia.org/wiki/VBScripthttps://en.wikipedia.org/wiki/VBScripthttps://en.wikipedia.org/wiki/VBScripthttps://en.wikipedia.org/wiki/JScripthttps://en.wikipedia.org/wiki/JScripthttps://en.wikipedia.org/wiki/JScripthttps://en.wikipedia.org/wiki/Internet_Explorer_3https://en.wikipedia.org/wiki/Internet_Explorer_3https://en.wikipedia.org/wiki/Internet_Explorer_3https://en.wikipedia.org/wiki/Internet_Information_Serverhttps://en.wikipedia.org/wiki/Internet_Information_Serverhttps://en.wikipedia.org/wiki/Internet_Information_Serverhttps://en.wikipedia.org/wiki/Internet_Information_Serverhttps://en.wikipedia.org/wiki/Cascading_Style_Sheetshttps://en.wikipedia.org/wiki/Cascading_Style_Sheetshttps://en.wikipedia.org/wiki/Cascading_Style_Sheetshttps://en.wikipedia.org/wiki/Netscape_Navigatorhttps://en.wikipedia.org/wiki/Netscape_Navigatorhttps://en.wikipedia.org/wiki/Netscape_Navigatorhttps://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/Netscape_Navigatorhttps://en.wikipedia.org/wiki/Cascading_Style_Sheetshttps://en.wikipedia.org/wiki/Internet_Information_Serverhttps://en.wikipedia.org/wiki/Internet_Information_Serverhttps://en.wikipedia.org/wiki/Internet_Explorer_3https://en.wikipedia.org/wiki/JScripthttps://en.wikipedia.org/wiki/VBScripthttps://en.wikipedia.org/wiki/Microsoft_Windowshttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=4https://en.wikipedia.org/wiki/JavaScript#cite_note-RWW-Server-Side-2009-12-17-24https://en.wikipedia.org/wiki/JavaScript#cite_note-RWW-Server-Side-2009-12-17-24https://en.wikipedia.org/wiki/Node.jshttps://en.wikipedia.org/wiki/Comparison_of_server-side_JavaScript_solutionshttps://en.wikipedia.org/wiki/JavaScript#cite_note-Newscape_JavaScript_Guide-1998-22https://en.wikipedia.org/wiki/JavaScript#cite_note-Newscape_JavaScript_Guide-1998-22https://en.wikipedia.org/wiki/Netscape_Enterprise_Serverhttps://en.wikipedia.org/wiki/Netscape_Enterprise_Serverhttps://en.wikipedia.org/wiki/Server-side_scriptinghttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=3https://en.wikipedia.org/wiki/JavaScript#cite_note-20https://en.wikipedia.org/wiki/JavaScript#cite_note-20https://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/JavaScript#cite_note-19https://en.wikipedia.org/wiki/ViolaWWWhttps://en.wikipedia.org/wiki/JavaScript#cite_note-18https://en.wikipedia.org/wiki/JavaScript#cite_note-17https://en.wikipedia.org/wiki/JavaScript#cite_note-15https://en.wikipedia.org/wiki/JavaScript#cite_note-15https://en.wikipedia.org/wiki/C--https://en.wikipedia.org/wiki/C--https://en.wikipedia.org/wiki/Openwavehttps://en.wikipedia.org/wiki/JavaScript#cite_note-13https://en.wikipedia.org/wiki/JavaScript#cite_note-13https://en.wikipedia.org/wiki/Netscape_Navigatorhttps://en.wikipedia.org/wiki/JavaScript#cite_note-techvision-12https://en.wikipedia.org/wiki/JavaScript#cite_note-11https://en.wikipedia.org/wiki/JavaScript#cite_note-10https://en.wikipedia.org/wiki/JavaScript#JavaScript_and_Javahttps://en.wikipedia.org/wiki/Interpreted_languagehttps://en.wikipedia.org/wiki/C%2B%2Bhttps://en.wikipedia.org/wiki/Wikipedia:Citation_neededhttps://en.wikipedia.org/wiki/Java_applethttps://en.wikipedia.org/wiki/Sun_Microsystemshttps://en.wikipedia.org/wiki/Microsofthttps://en.wikipedia.org/wiki/Netscape_Communications_Corporationhttps://en.wikipedia.org/wiki/Brendan_Eichhttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=2https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=1https://en.wikipedia.org/wiki/JavaScript#External_linkshttps://en.wikipedia.org/wiki/JavaScript#Further_readinghttps://en.wikipedia.org/wiki/JavaScript#Referenceshttps://en.wikipedia.org/wiki/JavaScript#JavaScript_and_Javahttps://en.wikipedia.org/wiki/JavaScript#Use_as_an_intermediate_languagehttps://en.wikipedia.org/wiki/JavaScript#Related_languages_and_featureshttps://en.wikipedia.org/wiki/JavaScript#Version_historyhttps://en.wikipedia.org/wiki/JavaScript#Development_tools

  • 8/17/2019 Javascript Deep Introduction

    5/29

    in Netscape' and 'best viewed in Internet Explorer' logos that characterised these early years ofthe browser wars.[28] JavaScript began to acquire a reputation for being one of the roadblocks to across-platform and standards-driven Web. Some developers took on the difficult task of trying tomake their sites work in both major browsers, but many could not afford the time.[26] With the releaseof Internet Explorer 4, Microsoft introduced the concept of  Dynamic HTML, but the differences inlanguage implementations and the different and proprietary Document Object Modelsr emained, and

    were obstacles to widespread take-up of JavaScript on the Web.[26]

     

    Standardization [edit] 

    In November 1996, Netscape announced that it had submitted JavaScript to Ecma International forconsideration as an industry standard, and subsequent work resulted in the standardized versionnamed ECMAScript. In June 1997, Ecma International published the first edition of the ECMA-262 specification. In June 1998, some modifications were made to adapt it to the ISO/IEC-16262standard, and the second edition was released. The third edition of  ECMA-262 was published onDecember 1999.[29] 

    Development of the fourth edition of the ECMAScript standard was never completed.[30] The fifthedition was released in December 2009. The current edition of the ECMAScript standard is 6,released in June 2015.[31] 

    Later developments [edit] 

    JavaScript has become one of the most popular programming languages on the Web. Initially,however, many professional programmers denigrated the language because its target audienceconsisted of Web authors and other such "amateurs", among other reasons.[32] The adventof   Ajax returned JavaScript to the spotlight and brought more professional programming attention.The result was a proliferation of comprehensive frameworks and libraries, improved JavaScriptprogramming practices, and increased usage of JavaScript outside Web browsers, as seen by theproliferation of  server-side JavaScript platforms.

    In January 2009, the CommonJS project was founded with the goal of specifying a commonstandard library mainly for JavaScript development outside the browser .[33] 

    With the rise of the single-page application and JavaScript-heavy sites, it is increasingly being usedas a compile target for  source-to-source compilers from both dynamic languagesand staticlanguages. In particular, Emscripten and highly optimized JIT compilers, in tandem with asm.js thatis friendly to ahead-of-time compilers (AOT) like OdinMonkey, have enabled C and C++ programs tobe compiled into JavaScript and execute at near-native speeds, causing JavaScript to be consideredthe "assembly language of the Web",[34]according to its creator and others.

    Trademark [edit] 

    "JavaScript" is a trademark of  Oracle Corporation.[35] It is used under license for technology inventedand implemented by Netscape Communications and current entities such as theMozillaFoundation.[36] 

    Features[edit] The following features are common to all conforming ECMAScript implementations, unless explicitlyspecified otherwise.

    Imperative and structured[edit] 

    JavaScript supports much of the structured programming syntax

    from C (e.g., if statements, while loops, switch statements, do while loops, etc.). One partial

    exception isscoping: JavaScript originally had only function scoping with var. ECMAScript 2015

    https://en.wikipedia.org/wiki/Browser_warshttps://en.wikipedia.org/wiki/Browser_warshttps://en.wikipedia.org/wiki/JavaScript#cite_note-28https://en.wikipedia.org/wiki/JavaScript#cite_note-28https://en.wikipedia.org/wiki/JavaScript#cite_note-28https://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/Internet_Explorer_4https://en.wikipedia.org/wiki/Internet_Explorer_4https://en.wikipedia.org/wiki/Internet_Explorer_4https://en.wikipedia.org/wiki/Dynamic_HTMLhttps://en.wikipedia.org/wiki/Dynamic_HTMLhttps://en.wikipedia.org/wiki/Dynamic_HTMLhttps://en.wikipedia.org/wiki/Document_Object_Modelhttps://en.wikipedia.org/wiki/Document_Object_Modelhttps://en.wikipedia.org/wiki/Document_Object_Modelhttps://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=5https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=5https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=5https://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/wiki/ECMA-262https://en.wikipedia.org/wiki/ECMA-262https://en.wikipedia.org/wiki/ECMA-262https://en.wikipedia.org/wiki/Specificationhttps://en.wikipedia.org/wiki/Specificationhttps://en.wikipedia.org/wiki/Specificationhttps://en.wikipedia.org/wiki/ECMA-262https://en.wikipedia.org/wiki/ECMA-262https://en.wikipedia.org/wiki/ECMA-262https://en.wikipedia.org/wiki/JavaScript#cite_note-29https://en.wikipedia.org/wiki/JavaScript#cite_note-29https://en.wikipedia.org/wiki/JavaScript#cite_note-29https://en.wikipedia.org/wiki/JavaScript#cite_note-30https://en.wikipedia.org/wiki/JavaScript#cite_note-30https://en.wikipedia.org/wiki/JavaScript#cite_note-30https://en.wikipedia.org/wiki/JavaScript#cite_note-31https://en.wikipedia.org/wiki/JavaScript#cite_note-31https://en.wikipedia.org/wiki/JavaScript#cite_note-31https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=6https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=6https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=6https://en.wikipedia.org/wiki/JavaScript#cite_note-32https://en.wikipedia.org/wiki/JavaScript#cite_note-32https://en.wikipedia.org/wiki/JavaScript#cite_note-32https://en.wikipedia.org/wiki/Ajax_(programming)https://en.wikipedia.org/wiki/Ajax_(programming)https://en.wikipedia.org/wiki/Ajax_(programming)https://en.wikipedia.org/wiki/List_of_JavaScript_librarieshttps://en.wikipedia.org/wiki/List_of_JavaScript_librarieshttps://en.wikipedia.org/wiki/List_of_JavaScript_librarieshttps://en.wikipedia.org/wiki/Server-side_JavaScripthttps://en.wikipedia.org/wiki/Server-side_JavaScripthttps://en.wikipedia.org/wiki/Server-side_JavaScripthttps://en.wikipedia.org/wiki/CommonJShttps://en.wikipedia.org/wiki/CommonJShttps://en.wikipedia.org/wiki/CommonJShttps://en.wikipedia.org/wiki/JavaScript#cite_note-33https://en.wikipedia.org/wiki/JavaScript#cite_note-33https://en.wikipedia.org/wiki/JavaScript#cite_note-33https://en.wikipedia.org/wiki/Single-page_applicationhttps://en.wikipedia.org/wiki/Single-page_applicationhttps://en.wikipedia.org/wiki/Single-page_applicationhttps://en.wikipedia.org/wiki/Source-to-source_compilerhttps://en.wikipedia.org/wiki/Source-to-source_compilerhttps://en.wikipedia.org/wiki/Source-to-source_compilerhttps://en.wikipedia.org/wiki/Dynamic_typinghttps://en.wikipedia.org/wiki/Dynamic_typinghttps://en.wikipedia.org/wiki/Static_typinghttps://en.wikipedia.org/wiki/Static_typinghttps://en.wikipedia.org/wiki/Static_typinghttps://en.wikipedia.org/wiki/Static_typinghttps://en.wikipedia.org/wiki/Emscriptenhttps://en.wikipedia.org/wiki/Emscriptenhttps://en.wikipedia.org/wiki/Emscriptenhttps://en.wikipedia.org/wiki/Just-in-time_compilerhttps://en.wikipedia.org/wiki/Just-in-time_compilerhttps://en.wikipedia.org/wiki/Just-in-time_compilerhttps://en.wikipedia.org/wiki/Asm.jshttps://en.wikipedia.org/wiki/Asm.jshttps://en.wikipedia.org/wiki/Asm.jshttps://en.wikipedia.org/wiki/Ahead-of-time_compilationhttps://en.wikipedia.org/wiki/Ahead-of-time_compilationhttps://en.wikipedia.org/wiki/Ahead-of-time_compilationhttps://en.wikipedia.org/wiki/OdinMonkeyhttps://en.wikipedia.org/wiki/OdinMonkeyhttps://en.wikipedia.org/wiki/OdinMonkeyhttps://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/C%2B%2Bhttps://en.wikipedia.org/wiki/C%2B%2Bhttps://en.wikipedia.org/wiki/C%2B%2Bhttps://en.wikipedia.org/wiki/JavaScript#cite_note-asm.js-34https://en.wikipedia.org/wiki/JavaScript#cite_note-asm.js-34https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=7https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=7https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=7https://en.wikipedia.org/wiki/Trademarkhttps://en.wikipedia.org/wiki/Trademarkhttps://en.wikipedia.org/wiki/Trademarkhttps://en.wikipedia.org/wiki/Oracle_Corporationhttps://en.wikipedia.org/wiki/Oracle_Corporationhttps://en.wikipedia.org/wiki/JavaScript#cite_note-35https://en.wikipedia.org/wiki/JavaScript#cite_note-35https://en.wikipedia.org/wiki/JavaScript#cite_note-35https://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/JavaScript#cite_note-36https://en.wikipedia.org/wiki/JavaScript#cite_note-36https://en.wikipedia.org/wiki/JavaScript#cite_note-36https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=8https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=8https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=8https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=9https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=9https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=9https://en.wikipedia.org/wiki/Structured_programminghttps://en.wikipedia.org/wiki/Structured_programminghttps://en.wikipedia.org/wiki/Structured_programminghttps://en.wikipedia.org/wiki/C_(computer_language)https://en.wikipedia.org/wiki/C_(computer_language)https://en.wikipedia.org/wiki/C_(computer_language)https://en.wikipedia.org/wiki/Scope_(computer_science)https://en.wikipedia.org/wiki/Scope_(computer_science)https://en.wikipedia.org/wiki/Function_scopinghttps://en.wikipedia.org/wiki/Function_scopinghttps://en.wikipedia.org/wiki/Function_scopinghttps://en.wikipedia.org/wiki/Function_scopinghttps://en.wikipedia.org/wiki/Scope_(computer_science)https://en.wikipedia.org/wiki/C_(computer_language)https://en.wikipedia.org/wiki/Structured_programminghttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=9https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=8https://en.wikipedia.org/wiki/JavaScript#cite_note-36https://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/JavaScript#cite_note-35https://en.wikipedia.org/wiki/Oracle_Corporationhttps://en.wikipedia.org/wiki/Trademarkhttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=7https://en.wikipedia.org/wiki/JavaScript#cite_note-asm.js-34https://en.wikipedia.org/wiki/C%2B%2Bhttps://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/OdinMonkeyhttps://en.wikipedia.org/wiki/Ahead-of-time_compilationhttps://en.wikipedia.org/wiki/Asm.jshttps://en.wikipedia.org/wiki/Just-in-time_compilerhttps://en.wikipedia.org/wiki/Emscriptenhttps://en.wikipedia.org/wiki/Static_typinghttps://en.wikipedia.org/wiki/Static_typinghttps://en.wikipedia.org/wiki/Dynamic_typinghttps://en.wikipedia.org/wiki/Source-to-source_compilerhttps://en.wikipedia.org/wiki/Single-page_applicationhttps://en.wikipedia.org/wiki/JavaScript#cite_note-33https://en.wikipedia.org/wiki/CommonJShttps://en.wikipedia.org/wiki/Server-side_JavaScripthttps://en.wikipedia.org/wiki/List_of_JavaScript_librarieshttps://en.wikipedia.org/wiki/Ajax_(programming)https://en.wikipedia.org/wiki/JavaScript#cite_note-32https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=6https://en.wikipedia.org/wiki/JavaScript#cite_note-31https://en.wikipedia.org/wiki/JavaScript#cite_note-30https://en.wikipedia.org/wiki/JavaScript#cite_note-29https://en.wikipedia.org/wiki/ECMA-262https://en.wikipedia.org/wiki/Specificationhttps://en.wikipedia.org/wiki/ECMA-262https://en.wikipedia.org/wiki/ECMA-262https://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/wiki/ECMAScripthttps://en.wikipedia.org/wiki/Ecma_Internationalhttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=5https://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/Document_Object_Modelhttps://en.wikipedia.org/wiki/Dynamic_HTMLhttps://en.wikipedia.org/wiki/Internet_Explorer_4https://en.wikipedia.org/wiki/JavaScript#cite_note-O.27Reilly-2001-26https://en.wikipedia.org/wiki/JavaScript#cite_note-28https://en.wikipedia.org/wiki/Browser_wars

  • 8/17/2019 Javascript Deep Introduction

    6/29

    adds a let keyword for block scoping, meaning JavaScript now has both function and blockscoping. Like C, JavaScript makes a distinction between expressions and statements. One syntacticdifference from C is automatic semicolon insertion, which allows the semicolons that would normallyterminate statements to be omitted.[37] 

    Dynamic[edit] 

    Typing As with most scripting languages, JavaScript is dynamically typed; a type is associated witheach value, rather than just with each expression. For example, a variable that is at one timebound to a number may later be re-bound to a string.[38] JavaScript supports various ways totest the type of an object, including duck typing.[39] 

    Run-time evaluation

    JavaScript includes an eval function that can execute statements provided as strings at run-time.

    Prototype-based (Object-oriented)[edit] 

    JavaScript is almost entirely object-based. In JavaScript, an object is an associative array, augmented with a prototype (see below); each string key provides the name for an objectproperty, and there are two syntactical ways to specify such a name: dot notation

    (obj.x = 10) and bracket notation (obj['x'] = 10). A property may be added, rebound,or deleted at run-time. Most properties of an object (and any property that belongs to anobject's prototype inheritance chain) can be enumerated using a for...in loop.

    JavaScript has a small number of built-in objects, including Function and Date.

    Prototypes

    JavaScript uses prototypes where many other object-oriented languagesuse classes for  inheritance.[40] It is possible to simulate many class-based features withprototypes in JavaScript.[41] 

    Functions as object constructors

    Functions double as object constructors along with their typical role. Prefixing a function callwith new will create an instance of a prototype, inheriting properties and methods from the

    constructor (including properties from the Object prototype).[42] ECMAScript 5 offersthe Object.create method, allowing explicit creation of an instance without automatically

    inheriting from the Object prototype (older environments can assign the prototype

    to null).[43] The constructor's prototype property determines the object used for the newobject's internal prototype. New methods can be added by modifying the prototype of thefunction used as a constructor. JavaScript's built-in constructors, such asArray or Object,also have prototypes that can be modified. While it is possible to modify

    the Object prototype, it is generally considered bad practice because most objects in

    JavaScript will inherit methods and properties from the Object prototype and they may notexpect the prototype to be modified.[44] 

    Functions as methods

    Unlike many object-oriented languages, there is no distinction between a function definition

    and a method definition. Rather, the distinction occurs during function calling; when afunction is called as a method of an object, the function's local this keyword is bound to thatobject for that invocation.

    Functional[edit] 

     A function is first-class; a function is considered to be an object. As such, afunction may have properties and methods, such

    as .call() and .bind().[45]  A nested function is a function defined withinanother function. It is created each time the outer function is invoked. In

    https://en.wikipedia.org/wiki/Expression_(computer_science)https://en.wikipedia.org/wiki/Expression_(computer_science)https://en.wikipedia.org/wiki/Expression_(computer_science)https://en.wikipedia.org/wiki/Statement_(computer_science)https://en.wikipedia.org/wiki/Statement_(computer_science)https://en.wikipedia.org/wiki/Statement_(computer_science)https://en.wikipedia.org/wiki/Defensive_semicolonhttps://en.wikipedia.org/wiki/Defensive_semicolonhttps://en.wikipedia.org/wiki/Defensive_semicolonhttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan200616-37https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan200616-37https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan200616-37https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=10https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=10https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=10https://en.wikipedia.org/wiki/Scripting_languagehttps://en.wikipedia.org/wiki/Scripting_languagehttps://en.wikipedia.org/wiki/Scripting_languagehttps://en.wikipedia.org/wiki/Dynamic_typinghttps://en.wikipedia.org/wiki/Dynamic_typinghttps://en.wikipedia.org/wiki/Dynamic_typinghttps://en.wikipedia.org/wiki/Type_systemhttps://en.wikipedia.org/wiki/Type_systemhttps://en.wikipedia.org/wiki/Type_systemhttps://en.wikipedia.org/wiki/Value_(computer_science)https://en.wikipedia.org/wiki/Value_(computer_science)https://en.wikipedia.org/wiki/Value_(computer_science)https://en.wikipedia.org/wiki/Variable_(programming)https://en.wikipedia.org/wiki/Variable_(programming)https://en.wikipedia.org/wiki/Variable_(programming)https://en.wikipedia.org/wiki/String_(computer_science)https://en.wikipedia.org/wiki/String_(computer_science)https://en.wikipedia.org/wiki/JavaScript#cite_note-38https://en.wikipedia.org/wiki/JavaScript#cite_note-38https://en.wikipedia.org/wiki/JavaScript#cite_note-38https://en.wikipedia.org/wiki/Duck_typinghttps://en.wikipedia.org/wiki/Duck_typinghttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan2006176.E2.80.93178-39https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan2006176.E2.80.93178-39https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan2006176.E2.80.93178-39https://en.wikipedia.org/wiki/Evalhttps://en.wikipedia.org/wiki/Evalhttps://en.wikipedia.org/wiki/Evalhttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=11https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=11https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=11https://en.wikipedia.org/wiki/Object-basedhttps://en.wikipedia.org/wiki/Object-basedhttps://en.wikipedia.org/wiki/Object-basedhttps://en.wikipedia.org/wiki/Object_(computer_science)https://en.wikipedia.org/wiki/Object_(computer_science)https://en.wikipedia.org/wiki/Object_(computer_science)https://en.wikipedia.org/wiki/Associative_arrayhttps://en.wikipedia.org/wiki/Associative_arrayhttps://en.wikipedia.org/wiki/Associative_arrayhttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Class_(computer_science)https://en.wikipedia.org/wiki/Class_(computer_science)https://en.wikipedia.org/wiki/Class_(computer_science)https://en.wikipedia.org/wiki/Inheritance_(computer_science)https://en.wikipedia.org/wiki/Inheritance_(computer_science)https://en.wikipedia.org/wiki/JavaScript#cite_note-40https://en.wikipedia.org/wiki/JavaScript#cite_note-40https://en.wikipedia.org/wiki/JavaScript#cite_note-40https://en.wikipedia.org/wiki/JavaScript#cite_note-41https://en.wikipedia.org/wiki/JavaScript#cite_note-41https://en.wikipedia.org/wiki/JavaScript#cite_note-41https://en.wikipedia.org/wiki/JavaScript#cite_note-42https://en.wikipedia.org/wiki/JavaScript#cite_note-42https://en.wikipedia.org/wiki/JavaScript#cite_note-42https://en.wikipedia.org/wiki/JavaScript#cite_note-43https://en.wikipedia.org/wiki/JavaScript#cite_note-43https://en.wikipedia.org/wiki/JavaScript#cite_note-43https://en.wikipedia.org/wiki/JavaScript#cite_note-44https://en.wikipedia.org/wiki/JavaScript#cite_note-44https://en.wikipedia.org/wiki/JavaScript#cite_note-44https://en.wikipedia.org/wiki/Method_(computer_science)https://en.wikipedia.org/wiki/Method_(computer_science)https://en.wikipedia.org/wiki/Method_(computer_science)https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=12https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=12https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=12https://en.wikipedia.org/wiki/Subroutinehttps://en.wikipedia.org/wiki/Subroutinehttps://en.wikipedia.org/wiki/Subroutinehttps://en.wikipedia.org/wiki/First-class_functionhttps://en.wikipedia.org/wiki/First-class_functionhttps://en.wikipedia.org/wiki/First-class_functionhttps://en.wikipedia.org/wiki/JavaScript#cite_note-45https://en.wikipedia.org/wiki/JavaScript#cite_note-45https://en.wikipedia.org/wiki/JavaScript#cite_note-45https://en.wikipedia.org/wiki/JavaScript#cite_note-45https://en.wikipedia.org/wiki/First-class_functionhttps://en.wikipedia.org/wiki/Subroutinehttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=12https://en.wikipedia.org/wiki/Method_(computer_science)https://en.wikipedia.org/wiki/JavaScript#cite_note-44https://en.wikipedia.org/wiki/JavaScript#cite_note-43https://en.wikipedia.org/wiki/JavaScript#cite_note-42https://en.wikipedia.org/wiki/JavaScript#cite_note-41https://en.wikipedia.org/wiki/JavaScript#cite_note-40https://en.wikipedia.org/wiki/Inheritance_(computer_science)https://en.wikipedia.org/wiki/Class_(computer_science)https://en.wikipedia.org/wiki/Prototype-based_programminghttps://en.wikipedia.org/wiki/Associative_arrayhttps://en.wikipedia.org/wiki/Object_(computer_science)https://en.wikipedia.org/wiki/Object-basedhttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=11https://en.wikipedia.org/wiki/Evalhttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan2006176.E2.80.93178-39https://en.wikipedia.org/wiki/Duck_typinghttps://en.wikipedia.org/wiki/JavaScript#cite_note-38https://en.wikipedia.org/wiki/String_(computer_science)https://en.wikipedia.org/wiki/Variable_(programming)https://en.wikipedia.org/wiki/Value_(computer_science)https://en.wikipedia.org/wiki/Type_systemhttps://en.wikipedia.org/wiki/Dynamic_typinghttps://en.wikipedia.org/wiki/Scripting_languagehttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=10https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan200616-37https://en.wikipedia.org/wiki/Defensive_semicolonhttps://en.wikipedia.org/wiki/Statement_(computer_science)https://en.wikipedia.org/wiki/Expression_(computer_science)

  • 8/17/2019 Javascript Deep Introduction

    7/29

    addition, each nested function forms a lexical closure: The lexical scope of theouter function (including any constant, local variable, or argument value)becomes part of the internal state of each inner function object, even afterexecution of the outer function concludes.[46] JavaScript alsosupports anonymous functions. 

    Delegative[edit] 

    JavaScript supports implicit and explicit delegation. 

    Functions as Roles (Traits and Mixins )

    JavaScript natively supports various function-based implementations of  Role[47] patternslike Traits[48][49] and Mixins.[50] Such a function defines additional behavior by at least onemethod bound to the this keyword within its function body. A Role then has to be

    delegated explicitly via call or apply to objects that need to feature additional behavior that

    is not shared via the prototype chain.

    Object Composition and Inheritance

    Whereas explicit function-based delegation does cover  composition in JavaScript, implicitdelegation already happens every time the prototype chain is walked in order to, e.g., find amethod that might be related to but is not directly owned by an object. Once the method is

    found it gets called within this object's context. Thus inheritance in JavaScript is covered by adelegation automatism that is bound to the prototype property of constructor functions.

    Miscellaneous [edit] Run-time environment

    JavaScript typically relies on a run-time environment (e.g., a Web browser ) to provide objectsand methods by which scripts can interact with the environment (e.g., a webpage DOM). Italso relies on the run-time environment to provide the ability to include/import scripts(e.g., HTML  elements). This is not a language feature per se, but it is common inmost JavaScript implementations.

    JavaScript processes messages from a queue one at a time. Upon loading a new message,JavaScript calls a function associated with that message, which creates a call stackf rame(the function's arguments and local variables). The call stack shrinks and grows based onthe function's needs. Upon function completion, when the stack is empty, JavaScriptproceeds to the next message in the queue. This is called the event loop, described as "runto completion" because each message is fully processed before the next message isconsidered. However, the language's concurrency model describes the event loop as non-blocking: program input/output is performed using events and callback functions. Thismeans, for instance, that JavaScript can process a mouse click while waiting for a databasequery to return information.[51] 

    Variadic funct ions

     An indefinite number of parameters can be passed to a function. The function can accessthem through formal parameters and also through the local arguments object. Variadic

    functions can also be created by using the bind method.

     Array and object l iterals

    Like many scripting languages, arrays and objects (associative arrays in other languages)can each be created with a succinct shortcut syntax. In fact, these literals form the basis ofthe JSON data format.

    Regular expressions

    JavaScript also supports regular expressions in a manner similar to Perl, which provide aconcise and powerful syntax for text manipulation that is more sophisticated than the built-instring functions.[52] 

    Vendor-specific extensions [edit] 

    https://en.wikipedia.org/wiki/Closure_(computer_programming)https://en.wikipedia.org/wiki/Closure_(computer_programming)https://en.wikipedia.org/wiki/Closure_(computer_programming)https://en.wikipedia.org/wiki/Scope_(programming)#Lexical_scoping_vs._dynamic_scopinghttps://en.wikipedia.org/wiki/Scope_(programming)#Lexical_scoping_vs._dynamic_scopinghttps://en.wikipedia.org/wiki/Scope_(programming)#Lexical_scoping_vs._dynamic_scopinghttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan2006141-46https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan2006141-46https://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan2006141-46https://en.wikipedia.org/wiki/Anonymous_functionhttps://en.wikipedia.org/wiki/Anonymous_functionhttps://en.wikipedia.org/wiki/Anonymous_functionhttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=13https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=13https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=13https://en.wikipedia.org/wiki/Delegation_(object-oriented_programming)https://en.wikipedia.org/wiki/Delegation_(object-oriented_programming)https://en.wikipedia.org/wiki/Delegation_(object-oriented_programming)https://en.wikipedia.org/wiki/Role-oriented_programminghttps://en.wikipedia.org/wiki/Role-oriented_programminghttps://en.wikipedia.org/wiki/Role-oriented_programminghttps://en.wikipedia.org/wiki/Role-oriented_programminghttps://en.wikipedia.org/wiki/Traits_(computer_science)https://en.wikipedia.org/wiki/Traits_(computer_science)https://en.wikipedia.org/wiki/Traits_(computer_science)https://en.wikipedia.org/wiki/JavaScript#cite_note-49https://en.wikipedia.org/wiki/JavaScript#cite_note-49https://en.wikipedia.org/wiki/Mixinhttps://en.wikipedia.org/wiki/Mixinhttps://en.wikipedia.org/wiki/JavaScript#cite_note-50https://en.wikipedia.org/wiki/JavaScript#cite_note-50https://en.wikipedia.org/wiki/JavaScript#cite_note-50https://en.wikipedia.org/wiki/Object_compositionhttps://en.wikipedia.org/wiki/Object_compositionhttps://en.wikipedia.org/wiki/Object_compositionhttps://en.wikipedia.org/wiki/Inheritance_(computer_science)https://en.wikipedia.org/wiki/Inheritance_(computer_science)https://en.wikipedia.org/wiki/Inheritance_(computer_science)https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=14https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=14https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=14https://en.wikipedia.org/wiki/Web_browserhttps://en.wikipedia.org/wiki/Web_browserhttps://en.wikipedia.org/wiki/Web_browserhttps://en.wikipedia.org/wiki/HTMLhttps://en.wikipedia.org/wiki/HTMLhttps://en.wikipedia.org/wiki/HTMLhttps://en.wikipedia.org/wiki/Message_(computer_science)https://en.wikipedia.org/wiki/Message_(computer_science)https://en.wikipedia.org/wiki/Message_(computer_science)https://en.wikipedia.org/wiki/Queue_(abstract_data_type)https://en.wikipedia.org/wiki/Queue_(abstract_data_type)https://en.wikipedia.org/wiki/Queue_(abstract_data_type)https://en.wikipedia.org/wiki/Subroutinehttps://en.wikipedia.org/wiki/Subroutinehttps://en.wikipedia.org/wiki/Subroutinehttps://en.wikipedia.org/wiki/Call_stackhttps://en.wikipedia.org/wiki/Call_stackhttps://en.wikipedia.org/wiki/Call_stackhttps://en.wikipedia.org/wiki/Parameter_(computer_programming)https://en.wikipedia.org/wiki/Parameter_(computer_programming)https://en.wikipedia.org/wiki/Parameter_(computer_programming)https://en.wikipedia.org/wiki/Local_variablehttps://en.wikipedia.org/wiki/Local_variablehttps://en.wikipedia.org/wiki/Local_variablehttps://en.wikipedia.org/wiki/Event_loophttps://en.wikipedia.org/wiki/Event_loophttps://en.wikipedia.org/wiki/Event_loophttps://en.wikipedia.org/wiki/Concurrency_(computer_science)https://en.wikipedia.org/wiki/Concurrency_(computer_science)https://en.wikipedia.org/wiki/Concurrency_(computer_science)https://en.wikipedia.org/wiki/Asynchronous_I/Ohttps://en.wikipedia.org/wiki/Asynchronous_I/Ohttps://en.wikipedia.org/wiki/Asynchronous_I/Ohttps://en.wikipedia.org/wiki/Asynchronous_I/Ohttps://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/Event_(computing)https://en.wikipedia.org/wiki/Event_(computing)https://en.wikipedia.org/wiki/Event_(computing)https://en.wikipedia.org/wiki/Callback_(computer_programming)https://en.wikipedia.org/wiki/Callback_(computer_programming)https://en.wikipedia.org/wiki/Callback_(computer_programming)https://en.wikipedia.org/wiki/JavaScript#cite_note-51https://en.wikipedia.org/wiki/JavaScript#cite_note-51https://en.wikipedia.org/wiki/JavaScript#cite_note-51https://en.wikipedia.org/wiki/Formal_parameterhttps://en.wikipedia.org/wiki/Formal_parameterhttps://en.wikipedia.org/wiki/Formal_parameterhttps://en.wikipedia.org/wiki/Variadic_functionshttps://en.wikipedia.org/wiki/Variadic_functionshttps://en.wikipedia.org/wiki/Variadic_functionshttps://en.wikipedia.org/wiki/Variadic_functionshttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bindhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bindhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bindhttps://en.wikipedia.org/wiki/Associative_arrayshttps://en.wikipedia.org/wiki/Associative_arrayshttps://en.wikipedia.org/wiki/Associative_arrayshttps://en.wikipedia.org/wiki/Object_literalhttps://en.wikipedia.org/wiki/Object_literalhttps://en.wikipedia.org/wiki/Object_literalhttps://en.wikipedia.org/wiki/JSONhttps://en.wikipedia.org/wiki/JSONhttps://en.wikipedia.org/wiki/JSONhttps://en.wikipedia.org/wiki/Regular_expressionhttps://en.wikipedia.org/wiki/Regular_expressionhttps://en.wikipedia.org/wiki/Regular_expressionhttps://en.wikipedia.org/wiki/Perlhttps://en.wikipedia.org/wiki/Perlhttps://en.wikipedia.org/wiki/Perlhttps://en.wikipedia.org/wiki/JavaScript#cite_note-52https://en.wikipedia.org/wiki/JavaScript#cite_note-52https://en.wikipedia.org/wiki/JavaScript#cite_note-52https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=15https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=15https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=15https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=15https://en.wikipedia.org/wiki/JavaScript#cite_note-52https://en.wikipedia.org/wiki/Perlhttps://en.wikipedia.org/wiki/Regular_expressionhttps://en.wikipedia.org/wiki/JSONhttps://en.wikipedia.org/wiki/Object_literalhttps://en.wikipedia.org/wiki/Associative_arrayshttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bindhttps://en.wikipedia.org/wiki/Variadic_functionshttps://en.wikipedia.org/wiki/Variadic_functionshttps://en.wikipedia.org/wiki/Formal_parameterhttps://en.wikipedia.org/wiki/JavaScript#cite_note-51https://en.wikipedia.org/wiki/Callback_(computer_programming)https://en.wikipedia.org/wiki/Event_(computing)https://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/Asynchronous_I/Ohttps://en.wikipedia.org/wiki/Asynchronous_I/Ohttps://en.wikipedia.org/wiki/Concurrency_(computer_science)https://en.wikipedia.org/wiki/Event_loophttps://en.wikipedia.org/wiki/Local_variablehttps://en.wikipedia.org/wiki/Parameter_(computer_programming)https://en.wikipedia.org/wiki/Call_stackhttps://en.wikipedia.org/wiki/Subroutinehttps://en.wikipedia.org/wiki/Queue_(abstract_data_type)https://en.wikipedia.org/wiki/Message_(computer_science)https://en.wikipedia.org/wiki/HTMLhttps://en.wikipedia.org/wiki/Web_browserhttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=14https://en.wikipedia.org/wiki/Inheritance_(computer_science)https://en.wikipedia.org/wiki/Object_compositionhttps://en.wikipedia.org/wiki/JavaScript#cite_note-50https://en.wikipedia.org/wiki/Mixinhttps://en.wikipedia.org/wiki/JavaScript#cite_note-49https://en.wikipedia.org/wiki/Traits_(computer_science)https://en.wikipedia.org/wiki/Traits_(computer_science)https://en.wikipedia.org/wiki/Role-oriented_programminghttps://en.wikipedia.org/wiki/Role-oriented_programminghttps://en.wikipedia.org/wiki/Delegation_(object-oriented_programming)https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=13https://en.wikipedia.org/wiki/Anonymous_functionhttps://en.wikipedia.org/wiki/JavaScript#cite_note-FOOTNOTEFlanagan2006141-46https://en.wikipedia.org/wiki/Scope_(programming)#Lexical_scoping_vs._dynamic_scopinghttps://en.wikipedia.org/wiki/Closure_(computer_programming)

  • 8/17/2019 Javascript Deep Introduction

    8/29

    JavaScript is officially managed by MozillaFoundation, and new language features are addedperiodically. However, only some JavaScriptengines support these new features:

      property getter and setter functions (supported

    by WebKit, Gecko, Opera,[53]  ActionScript, andRhino)[54] 

      conditional catch clauses

      iterator protocol (adopted from Python) 

      shallow generators-coroutines (adopted fromPython)

      array comprehensions and generatorexpressions (adopted from Python)

      proper block scope via the let keyword

      array and object destructuring (limited formof  pattern matching) 

      concise function expressions

    (function(args) expr)

      ECMAScript for XML (E4X), an extension thatadds native XML support to ECMAScript(unsupported in Firefox since version 21[55]) 

    Syntax[edit] Main article: JavaScript syntax 

    Simple examples[edit] 

    Variables in JavaScript can be defined usingthe var keyword:[56] 

    var x; // defines the variable x, the

    special value “undefined” (not to be

    confused with an undefined value) is

    assigned to it by default 

    var y = 2; // defines the variable y

    and assigns the value of 2 to it 

    Note the comments in the example above, both ofwhich were preceded with two forward slashes. 

    There is no built-in I/O functionality in JavaScript;the run-time environment provides that. TheECMAScript specification in edition 5.1mentions:[57] 

    … indeed, there are no provisions in thisspecification for input of external data or output ofcomputed results.

    https://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/JavaScript_enginehttps://en.wikipedia.org/wiki/JavaScript_enginehttps://en.wikipedia.org/wiki/JavaScript_enginehttps://en.wikipedia.org/wiki/JavaScript_enginehttps://en.wikipedia.org/wiki/JavaScript#cite_note-53https://en.wikipedia.org/wiki/JavaScript#cite_note-53https://en.wikipedia.org/wiki/JavaScript#cite_note-53https://en.wikipedia.org/wiki/JavaScript#cite_note-54https://en.wikipedia.org/wiki/JavaScript#cite_note-54https://en.wikipedia.org/wiki/JavaScript#cite_note-54https://en.wikipedia.org/wiki/Python_(programming_language)https://en.wikipedia.org/wiki/Python_(programming_language)https://en.wikipedia.org/wiki/Python_(programming_language)https://en.wikipedia.org/wiki/Generator_(computer_programming)https://en.wikipedia.org/wiki/Generator_(computer_programming)https://en.wikipedia.org/wiki/Coroutinehttps://en.wikipedia.org/wiki/Coroutinehttps://en.wikipedia.org/wiki/Coroutinehttps://en.wikipedia.org/wiki/List_comprehensionhttps://en.wikipedia.org/wiki/List_comprehensionhttps://en.wikipedia.org/wiki/Pattern_matchinghttps://en.wikipedia.org/wiki/Pattern_matchinghttps://en.wikipedia.org/wiki/Pattern_matchinghttps://en.wikipedia.org/wiki/ECMAScript_for_XMLhttps://en.wikipedia.org/wiki/ECMAScript_for_XMLhttps://en.wikipedia.org/wiki/JavaScript#cite_note-55https://en.wikipedia.org/wiki/JavaScript#cite_note-55https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=16https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=16https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=16https://en.wikipedia.org/wiki/JavaScript_syntaxhttps://en.wikipedia.org/wiki/JavaScript_syntaxhttps://en.wikipedia.org/wiki/JavaScript_syntaxhttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=17https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=17https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=17https://en.wikipedia.org/wiki/Variable_(computer_science)https://en.wikipedia.org/wiki/Variable_(computer_science)https://en.wikipedia.org/wiki/JavaScript#cite_note-56https://en.wikipedia.org/wiki/JavaScript#cite_note-56https://en.wikipedia.org/wiki/JavaScript#cite_note-56https://en.wikipedia.org/wiki/Comment_(computer_programming)https://en.wikipedia.org/wiki/Comment_(computer_programming)https://en.wikipedia.org/wiki/Comment_(computer_programming)https://en.wikipedia.org/wiki/Slash_(punctuation)https://en.wikipedia.org/wiki/Slash_(punctuation)https://en.wikipedia.org/wiki/Slash_(punctuation)https://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/JavaScript#cite_note-57https://en.wikipedia.org/wiki/JavaScript#cite_note-57https://en.wikipedia.org/wiki/JavaScript#cite_note-57https://en.wikipedia.org/wiki/JavaScript#cite_note-57https://en.wikipedia.org/wiki/Input/outputhttps://en.wikipedia.org/wiki/Slash_(punctuation)https://en.wikipedia.org/wiki/Comment_(computer_programming)https://en.wikipedia.org/wiki/JavaScript#cite_note-56https://en.wikipedia.org/wiki/Variable_(computer_science)https://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=17https://en.wikipedia.org/wiki/JavaScript_syntaxhttps://en.wikipedia.org/w/index.php?title=JavaScript&action=edit&section=16https://en.wikipedia.org/wiki/JavaScript#cite_note-55https://en.wikipedia.org/wiki/ECMAScript_for_XMLhttps://en.wikipedia.org/wiki/Pattern_matchinghttps://en.wikipedia.org/wiki/List_comprehensionhttps://en.wikipedia.org/wiki/Coroutinehttps://en.wikipedia.org/wiki/Generator_(computer_programming)https://en.wikipedia.org/wiki/Python_(programming_language)https://en.wikipedia.org/wiki/JavaScript#cite_note-54https://en.wikipedia.org/wiki/JavaScript#cite_note-53https://en.wikipedia.org/wiki/JavaScript_enginehttps://en.wikipedia.org/wiki/JavaScript_enginehttps://en.wikipedia.org/wiki/Mozilla_Foundationhttps://en.wikipedia.org/wiki/Mozilla_Foundation

  • 8/17/2019 Javascript Deep Introduction

    9/29

    However, most runtime environments have

    a console object[58] that can be used to printoutput. Here is a minimalist Hello World program: 

    console.log("Hello World!");

     A simple recursive function:

    function factorial(n) {

    if (n == 0) {

    return 1;

    }

    return n*factorial(n - 1);

    }

     Anonymous function (or lambda) syntaxand closure example:

    var displayClosure = function() {

    var count = 0;

    return function () {

    return ++count;

    };

    }