4. Origins & Future
• Appeared in 1995 – 18 years ago
• JavaScript !== Java
• ~2005 Ajax
• HTML5 APIs (Application Programming
Intervace)s
• ECMAScript
5. Features & Syntax
• Client Side Scripting Language
• Types
• C-like
• Operators
• Loops
• Constructors/Classes
6. Types
• Boolean true, false
• Interger 1, 2, 4, 5 …
• Strings “Hello World”
• Arrays [1, “Apple”, obj]
• Functions function (arg) {return arg*2; }
• Objects {member: “value”}
• Variables var date = new Date(),
place = “2 Daly Ave”
7. Objects
• Everything is an object
• Objects have constructors
• Constructors are invoked by “new”, Type and,
()
• For example: new Date()
• Closures
8. Operators
• + -
• Assignment =
• <, >
• Equals (almost) ==
• Equals ===
• not !
• AND &&
• OR ||
• Typeof
9. loops
• for (var x = 0; x < y.length; x += 1 ) {
// do stuff
}
• while(arr.length) {
arr.shift() // do stuff
}
14. HTML5
• Audio/Video
– Different encodings for each browser
– Default controls
– Pause, Play, Stop all through JS
• Canvas
– Pixels
• SVG
– Vector
– XML
15. HTML5
• CSS3
– Animations using GPU
– Gradients
– Has JavaScript hooks
• LocalStorage (unlike cookies)
– is an object
– persists over sessions
– SessionStorage