JAVASCRIPT
Java vs JavaScript
 Java - Programming Language (PL)
 Interactive Web Graphics
 Creating web browser applications
 Writing stand-alone applications
 JavaScript - Scripting Language
 Runs within the context of the Web browser
 Customizing pages based on browser version
 Visual Feedback to user actions
 Validating data entered on HTML Forms
 In reality, Java and JavaScript are unrelated…
PL versus SL – By Definition
3
PL versus SL – By Type
4
PL versus SL – By Interpretation
5
PL versus SL – By Conversion
6
PL versus SL - Examples
7
Javascript(JS)
 Lightweight, interpreted, object oriented language with first class
functions and its best knows as scripting language for web pages
 Light weight- Small memory footprint, easy to implement
 interpreted- Instruction executed directly
 object oriented – Model around objects
 first class function – functions can be used as value
History
9
Why JS
 Client side web development (Navigators Javascript)
 Native JS- not a framework
 JQuery – Library
 Angular JS, React JS, Ember JS – advance client side application
framework
 Server side web development (Live wire Javascript)
 Node JS
 Express JS (works with node)
 Desktop , mobile and browser extensions(add-on and
plug-in)
 RTE - browser
Data Types
 Number
 String
 Boolean
 Undefined
 Null
 Symbol
Type coersion
 Explicit coersion
 Implicit coersion
 Every value in javascript has boolean value
Objects*
 Free form – not bound to any class
 Object literal to create object
 Property of object can be accessed directly
 New property can be added directly on objects
 Objects can have methods
_______________________________________
 Dot notation versus [ ] notation
Array
 ARRAY IS SECRETLY AN OBJECT
Eg: var myArray=[“Hi”,”1”,”Hello”];
myArray[0] and myArray[“0”] results same
o/p
 length property(checking the index not the
count)
Function
 Function Declaration
 Function with args
 Function with return
 Function expression
 Anonymous function expression
 Function as args
 Function as Objects
Scope and Closure
 Scope
Scope is based on function
Not all variables are accessible anywhere
Global function vs IIFE
Read vs Write
Compilation vs Interpretation
 Closure
Module pattern
Regular fn vs Constructor
 Functions are objects
 Dunder proto
 Inheritance

Js slideshare

  • 1.
  • 2.
    Java vs JavaScript Java - Programming Language (PL)  Interactive Web Graphics  Creating web browser applications  Writing stand-alone applications  JavaScript - Scripting Language  Runs within the context of the Web browser  Customizing pages based on browser version  Visual Feedback to user actions  Validating data entered on HTML Forms  In reality, Java and JavaScript are unrelated…
  • 3.
    PL versus SL– By Definition 3
  • 4.
    PL versus SL– By Type 4
  • 5.
    PL versus SL– By Interpretation 5
  • 6.
    PL versus SL– By Conversion 6
  • 7.
    PL versus SL- Examples 7
  • 8.
    Javascript(JS)  Lightweight, interpreted,object oriented language with first class functions and its best knows as scripting language for web pages  Light weight- Small memory footprint, easy to implement  interpreted- Instruction executed directly  object oriented – Model around objects  first class function – functions can be used as value
  • 9.
  • 10.
    Why JS  Clientside web development (Navigators Javascript)  Native JS- not a framework  JQuery – Library  Angular JS, React JS, Ember JS – advance client side application framework  Server side web development (Live wire Javascript)  Node JS  Express JS (works with node)  Desktop , mobile and browser extensions(add-on and plug-in)  RTE - browser
  • 11.
    Data Types  Number String  Boolean  Undefined  Null  Symbol
  • 12.
    Type coersion  Explicitcoersion  Implicit coersion  Every value in javascript has boolean value
  • 13.
    Objects*  Free form– not bound to any class  Object literal to create object  Property of object can be accessed directly  New property can be added directly on objects  Objects can have methods _______________________________________  Dot notation versus [ ] notation
  • 14.
    Array  ARRAY ISSECRETLY AN OBJECT Eg: var myArray=[“Hi”,”1”,”Hello”]; myArray[0] and myArray[“0”] results same o/p  length property(checking the index not the count)
  • 15.
    Function  Function Declaration Function with args  Function with return  Function expression  Anonymous function expression  Function as args  Function as Objects
  • 16.
    Scope and Closure Scope Scope is based on function Not all variables are accessible anywhere Global function vs IIFE Read vs Write Compilation vs Interpretation  Closure Module pattern
  • 17.
    Regular fn vsConstructor  Functions are objects  Dunder proto  Inheritance