
Language (javaScript JS)
Get flash to fully experience Pearltrees
js.doc
Javascript and design pattern
JavaScript tutorial: Variable scope and the var keyword.
Simple example with comments: <html><head><script type="text/javascript" language="JavaScript"><!-- var numberCars = 3; // global numberTrees = 15; // global if (numberTrees > numberCars) { var numberRoads = 4; // global } else { var numberLakes = 9; // global, but will be undefined since never get in here. } function simpleFunction() { var colorCar = 'blue'; // local colorTree = 'green'; // global, once this function is called if (colorCar !Formation JavaScript - Table des matières
Closures are often considered an advanced feature in JavaScript, but understanding them is essential to mastering the language. Consider the following function: The init() function creates a local variable called name , and then defines a function called displayName() . displayName() is an inner function — it is defined inside init() , and is only available within the body of that function. displayName() has no local variables of its own, but reuses the name variable declared in the outer function.
Closures
JavaScript is an object-based language based on prototypes, rather than being class-based. Because of this different basis, it can be less apparent how JavaScript allows you to create hierarchies of objects and to have inheritance of properties and their values. This chapter attempts to clarify the situation. This chapter assumes that you are already somewhat familiar with JavaScript and that you have used JavaScript functions to create simple objects. Class-based vs. prototype-based languages
Details of the object model (Class-based vs. prototype-based languages)
Closures (Javascript)
String (javascript)

