Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- __proto__



  Understand JavaScript prototype

For an front end programming language like JavaScript, if we want to understand its OOP feature, we need to understand its objects, prototype chain, execution context, closure and this keyword in deep. If you have a good understanding on these concepts, you should be confident that you can handle this language well. The inheritance in JavaScript is not class inheritance like Java, but it adopts another mechanism-- prototype inheritance. The key to prototype inheritance is the prototype chain mec...

   JavaScript, prototype, __proto__     2013-02-02 02:34:09

  Prototypes and Inheritance in JavaScript

Forget everything you know about object-oriented programming. Instead, I want you to think about race cars. Yes – race cars. Recently I was watching the 24 Hours of Le Mans –a popular racing event in France. The fastest cars in the race are the Le Mans Prototypes. Although these cars are built by car manufacturers like Audi and Peugeot, they are not cars you’ll see on the streets and highways of your home town. They are built exclusively for high-speed endurance ra...

   JavaScript,Prototype,Inheritance     2012-02-27 04:55:22

  ECMAScript 5 Objects and Properties

ECMAScript 5 is on its way. Rising from the ashes of ECMAScript 4, which got scaled way back and became ECMAScript 3.1, which was then re-named ECMAScript 5 (more details)- comes a new layer of functionality built on top of our lovable ECMAScript 3. Update: I've posted more details on ECMAScript 5 Strict Mode, JSON, and More. There are a few new APIs included in the specification but the most interesting functionality comes into play in the Object/Property code. This new code gives you th...

   ECMAScript,Object,Property     2012-01-29 04:38:50

  A String is not an Error

I decided to write a little article to discourage an unfortunately common pattern in Node.JS modules (and browser JavaScript, to a lesser extent) that can boil down to these two examples: // A:function myFunction () {  if (somethingWrong) {    throw 'This is my error'  }  return allGood;} and // B: async Node.JS-style callback with signature `fn(err, …)`function myFunction (callback) {  doSomethingAsync(function () {    // …    if (...

   JavaScript,Node.js,String,Error object     2011-12-23 08:00:32

  Avoiding and exploiting JavaScript's warts

One's sentiment toward JavaScript flips between elegance and disgust without transiting intermediate states. The key to seeing JavaScript as elegant is understanding its warts, and knowing how to avoid, work around or even exploit them. I adopted this avoid/fix/exploit approach after reading Doug Crockford's JavaScript: The Good Parts: Doug has a slightly different and more elaborate take on the bad parts and awful parts, so I'm sharing my perspective on the four issues that ha...

   JavaScript,warts,Exploit,with,variable,this     2012-02-15 05:51:21

  10 reasons why Dart is cooler than JavaScript

Dart is a new programming language from Google and after coding JavaScript for over one year now, I immediately felt in love with it. Coming from the Java world I had a good bunch of things I had to learn before I could use JavaScript. Some people say, you need to dig deep into JavaScript, otherwise you are not allowed to speak about the pros and cons of a language. I am not a JavaScript Ninja. But I strongly believe a programming language should be easy to learn, easy to understand and s...

   Dart,JavaScript,Comparison     2012-01-05 08:23:21

  Prototypes in JavaScript

Following on from his previous article, David Chisnall explores JavaScript as an example of prototype-based object orientation. In this article, he shows how it's possible to implement more complex object models on top of this simple abstraction.My previous article, Prototypes and Object Orientation, considered the differences between class-based and prototype-based object orientation. In this article, we'll look in a bit more detail at the workings of the JavaScript object model, since it'...

   JavaScript,Prototype,Object oriented,Obj     2011-09-02 11:44:12