The talk, JavaScript the good parts is basically an excerpt of the speaker's book.
Although Crockford admits there are problems with JavaScript, even very annoying ones, JavaScript is still a very powerful programming language.
Some of the bad
One of the several shocking example of what 's wrong with JavaScript if the following snippet of code:
return
{
ok: false
};
Now, consider the very similar code:
return {
ok: false
};
One could expect that the two snippets would do the same thing. In most traditional language, the position of the curly brackets is simply a mater of personal preference. In JavaScript, it is not.
The fist snippets simply returns without doing anything. This is because JavaScript has the annoying habit of automatically adding semicolons under some circumstances. This is one of them. The second snippet returns a block of code. A simple new line changes completely the execution of the code. Thanks JavaScript...
Some the good
Despite all its faults, JavaScript is just another dynamic languages. So it comes with all the standard dynamic languages goodies like:
- Lambda
- Dynamic Object
- Loose Typing
- Object Literal
- Prototypal Inheritance
The jist of the talk is that your should go with the grain when working with JavaScript. This mean actually learning the language and take full advantage of it while avoiding the bad parts. JavaScript is a very powerful language to write nice dynamic web applications. It has its faults sure, be there are way to navigate around those.
There's a lot more in the talk, I hope you enjoy it as much as I did!
No comments:
Post a Comment