Javascript
@ketanghumatkar
Little history
● What is javascript?
● Where did it come from?
● What does Javascript do?
● Want to get some?
What is JavaScript
JavaScript ≠ Java
Java is complex; requires declarations, compiling, and servers
JavaScript is unrelated to Java, except that: both use C syntax
JavaScript uses many Java names and naming conventions
JavaScript looks like Java, but is easier for less technical users to program
Where did it come from?
● designed by Brendan
Eich Silicon Graphics,
Netscape now CTO of Mozilla (spin off from AOL/Netscape)
● originally called Mocha, then LiveScript
built for Netscape browser partnership between Sun Microsystems and Netscape
(Java runtime environment) trademark of Sun, used under lic
What does it all mean?
● capabilities
scripting language
easy to use and learn runtime,
not compiled primarily client side,
but also server side snippets
● interacts with HTML and DOM
browser control form validation, formatting rollover, etc.
adds client side application support
Data type - primitive
● Boolean true/false var a = true;
● Number var a = 10;
● String var a = ‘I am here!’;
● null nothing, value unknown, empty var a = null;
● undefined value is not assigned var a; // a is undefined
Ref: https://javascript.info/types
Data type - non primitive
● Object
○ to store collections of data and more complex entities
● Symbol
○ to create unique identifiers for objects
Data type - nonprimitive
● Array
Conditional statements
● If-else
Loops
● For
● For..in
● Do..while
● Switch
● While
Ref: https://www.w3schools.com/jsref/jsref_statements.asp
Function as class
Function - declarative vs expressive
Assignment
Assignment output
DOM
Document Object Model - a standard for accessing documents
● Object
● Properties
● Methods
● Events
DOM continue...
● Properties document.cookie
● Methods document.getDocumentById(‘demo’)
● Events document.onclick = function() { console.log(123); }
Ref: https://www.w3schools.com/js/js_htmldom_document.asp
DOM continue...
Assignment

Javascript and DOM

  • 1.
  • 2.
    Little history ● Whatis javascript? ● Where did it come from? ● What does Javascript do? ● Want to get some?
  • 3.
    What is JavaScript JavaScript≠ Java Java is complex; requires declarations, compiling, and servers JavaScript is unrelated to Java, except that: both use C syntax JavaScript uses many Java names and naming conventions JavaScript looks like Java, but is easier for less technical users to program
  • 4.
    Where did itcome from? ● designed by Brendan Eich Silicon Graphics, Netscape now CTO of Mozilla (spin off from AOL/Netscape) ● originally called Mocha, then LiveScript built for Netscape browser partnership between Sun Microsystems and Netscape (Java runtime environment) trademark of Sun, used under lic
  • 5.
    What does itall mean? ● capabilities scripting language easy to use and learn runtime, not compiled primarily client side, but also server side snippets ● interacts with HTML and DOM browser control form validation, formatting rollover, etc. adds client side application support
  • 6.
    Data type -primitive ● Boolean true/false var a = true; ● Number var a = 10; ● String var a = ‘I am here!’; ● null nothing, value unknown, empty var a = null; ● undefined value is not assigned var a; // a is undefined Ref: https://javascript.info/types
  • 7.
    Data type -non primitive ● Object ○ to store collections of data and more complex entities ● Symbol ○ to create unique identifiers for objects
  • 8.
    Data type -nonprimitive ● Array
  • 9.
  • 10.
    Loops ● For ● For..in ●Do..while ● Switch ● While Ref: https://www.w3schools.com/jsref/jsref_statements.asp
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
    DOM Document Object Model- a standard for accessing documents ● Object ● Properties ● Methods ● Events
  • 16.
    DOM continue... ● Propertiesdocument.cookie ● Methods document.getDocumentById(‘demo’) ● Events document.onclick = function() { console.log(123); } Ref: https://www.w3schools.com/js/js_htmldom_document.asp
  • 17.
  • 18.