Ready to expand your PHP web development skills with JavaScript? With this guide, you can use your experience with PHP to learn JavaScript from the ground up.
Your new post is loading...
Your new post is loading...
Ready to expand your PHP web development skills with JavaScript? With this guide, you can use your experience with PHP to learn JavaScript from the ground up. No comment yet.
Sign up to comment
Most programming languages contain good and bad parts, but JavaScript has more than its share of the bad, having been developed and released in a hurry before it could be refined.
Mickael Ruau's insight:
Si vous ne devez lire qu'un article sur javascript, lisez celui-ci de Douglas Crockford.
Mickael Ruau's insight:
This tutorial contains code and discussion from the book Secrets of the JavaScript Ninja by John Resig (Jquery inventor).
A Guide to JavaScript's Quirks and Flaws.
Mickael Ruau's insight:
The Prototype
JavaScript does not feature a classical inheritance model; instead, it uses aprototypal one. While this is often considered to be one of JavaScript's weaknesses, the prototypal inheritance model is in fact more powerful than the classic model.
A Guide to JavaScript's Quirks and Flaws.
Mickael Ruau's insight:
Scopes and Namespaces
Although JavaScript deals fine with the syntax of two matching curly braces for blocks, it does not support block scope; hence, all that is left in the language is function scope.
A Guide to JavaScript's Quirks and Flaws.
Mickael Ruau's insight:
Closures and References
One of JavaScript's most powerful features is the availability of closures. With closures, scopes always keep access to the outer scope, in which they were defined. Since the only scoping that JavaScript has is function scope, all functions, by default, act as closures. Avoiding the Reference Problem In order to copy the value of the loop's index variable, it is best to use ananonymous wrapper.
A Guide to JavaScript's Quirks and Flaws.
Mickael Ruau's insight:
setTimeout and setInterval
Since JavaScript is asynchronous, it is possible to schedule the execution of a function using the setTimeout and setInterval functions. Note: Timeouts are not part of the ECMAScript Standard. They are implemented as part of the DOM. function foo(){}var id = setTimeout(foo,1000);// returns a Number > 0 When setTimeout is called, it returns the ID of the timeout and schedule footo run approximately one thousand milliseconds in the future. foo will then be executed once. |
If you’re an advanced beginner or intermediate JavaScript developer, JavaScript Enlightenment will solidify your understanding of the language—especially if you use a JavaScript library. In this concise book, JavaScript expert Cody Lindle...
Mickael Ruau's insight:
Douglas Crockford is Yahoo!'s JavaScript architect and a member of the committee designing future versions of the world's most popular programming language.
A Guide to JavaScript's Quirks and Flaws.
Mickael Ruau's insight:
hasOwnProperty
To check whether an object has a property defined on itself and not somewhere on its prototype chain, it is necessary to use the hasOwnPropertymethod which all objects inherit from Object.prototype.
Note: It is not enough to check whether a property isundefined. The property might very well exist, but its value just happens to be set toundefined.
hasOwnProperty is the only thing in JavaScript which deals with properties and does not traverse the prototype chain.
A Guide to JavaScript's Quirks and Flaws.
Mickael Ruau's insight:
Everything in JavaScript acts like an object, with the only two exceptions being null and undefined. false.toString();// 'false'[1,2,3].toString();// '1,2,3' functionFoo(){} Foo.bar =1; Foo.bar;// 1 A common misconception is that number literals cannot be used as objects. That is because a flaw in JavaScript's parser tries to parse the dot notation on a number as a floating point literal. 2.toString();// raises SyntaxError There are a couple of workarounds that can be used to make number literals act as objects too. 2..toString();// the second point is correctly recognized2.toString();// note the space left to the dot (2).toString();// 2 is evaluated first
A Guide to JavaScript's Quirks and Flaws.
Mickael Ruau's insight:
Constructors
Constructors in JavaScript are yet again different from many other languages. Any function call that is preceded by the new keyword acts as a constructor. Inside the constructor - the called function - the value of this refers to a newly created object. The prototype of this new object is set to theprototype of the function object that was invoked as the constructor. If the function that was called has no explicit return statement, then it implicitly returns the value of this - the new object.
A Guide to JavaScript's Quirks and Flaws.
Mickael Ruau's insight:
How this Works
JavaScript has a different concept of what the special name this refers to than most other programming languages. There are exactly five different ways in which the value of this can be bound in the language. |
Your new post is loading...