JavaScript Primer
Basic Introduction of JavaScript
JavaScript Primer Basic Introduction of JavaScript JavaScript - - PowerPoint PPT Presentation
JavaScript Primer Basic Introduction of JavaScript JavaScript History Why (re)introduce JavaScript? Notorious for being worlds most misunderstood programming language o (Douglas Crockford -
Basic Introduction of JavaScript
(Douglas Crockford - http://javascript.crockford.com/javascript.html)
language
remained stable ever since.
concept of input or output.
SVG images, Yahoo’s widget engine, server-side environments as Node.js
an ordinary procedural language
Scheme:
to balance all those parens
do
q Number q String q Boolean q Object (Function, Array, Date, RegExp) q null q undefined
format IEEE 754 values
mathematical functionality
string to integer or floating point, respectively
characters
manipulate the string and access information about the string.
> var str = new String(”new string"); > str; > str.newProperty = ”new property value”; > str;
true and false.
falsy
and ! (logical not) are supported.
These work for both strings and numbers.
Does type coercion Avoids type coercion
… } else if (condition 2) { … } else { … } statements as in languages with C-like syntax
collections of name-value pairs.
JavaScript value — including more objects.
var obj1 = new Object(); // create an empty object with new operator var obj 2= {}; // use object literal notation
properties and methods
Object.prototype
use an object constructor function
function Person(name, age) { this.name = name; this.age = age; } // Define an object var You = new Person("You", 24); // We are creating a new person named "You" // (that was the first parameter, and the age..)
US/docs/Web/JavaScript/A_re-introduction_to_JavaScript