JavaScript: -Light weight Interpreted and JIT compiled programming language Light weight=>occupy less memory Interpreted=> line by line Compiled: translated at a time JIT-translates only when requested AOT-translates before its requested In browser who will compile/interpret your code: Browser engine Outside who will compile the code: -babel -V8 -node JS is a language that supports various programming paradigms: -structural programming -functional programming -imperative programming -OOPS JS is a language used in various application areas: -client side -server side -database -animation Why JS is called client side? How it will reduce the burden? -DOM Manipulation 1)Adding elements 2)updating data into element 3)handling styles dynamically BOM (Browser Interaction) History Navigation Location Document validation Send data to server only what is required Evolution of JS: CERN[council for European research and nuclear] lab built a script called ECMA for a browser called mosaic. Mosaic is the first browser. Netscape communication developed a browser called as Netscape communicator very popular browser ECMA script was not good for them so they hired a person called brendon to design scripting language he designed mocha which was later renamed to livescript unable to manage the live script so they gave it to sun microsystem they renamed it to Java script Issues of JS: -Not a strongly typed language ex: int age we have defined the type of variable as integer but in JS we don't define the type ex: var a; -Not strictly typed language -Not following programming rules (using shortcuts) -lot of inconsistency in code will come -JS is implicitly not strict we need to make it externally ex: -not an OOP language,it supports some feature of OOPS solution for this -Typescript Integrating JS into browser Just like CSS: -Inline -Embedded -External Inline:
Hello!!
prompt its a window method it pops up a input box to allow user input a value prompt syntax: prompt("Enter msg","optional message") prompt will return three different results based on scenario: -User doesn't enter anything but click ok=>will return empty -User enter value and click OK =>will return that value -User Click cancel=>will return null