So we have come to the last of my articles on object oriented JavaScript. You can read the last post by click ing here. This post will be about how JavaScript is proposed to change when (or if as the case may be) ECMAScript 4 (the spec that JavaScript is based on) is supported by the major browsers.
One of the changes that I am most happy about is the new proposed class structure. Yes JavaScript in the near future will be an object oriented language that is more in-line with languages like Java and C#.
Below is how the new structure is proposed.
Classes: A class describes an object by presenting those properties (fields) of the object that are always present (the
fixed properties or fixtures), including variables, constants, and methods16:class C { var val // a variable property var large = Infinity // a variable property const x = 3.14 // a constant property function f(n) { return n+val*2 } // a method property }You would create instances of the class using the new method, just as you currently would with the current JavaScript object.
So, the answer to the question of should you use object oriented JavaScript is a resounding, Yes, especially with the direction that it looks like the language is going. For a more information on ECMAScript 4 check out ecmascript.org. To go directly to an overview of ECMAScript 4 script click here.
As always if you have any questions you can leave them in the comments or private message me once you login to this site. Also, if you have anything that you would like to blog about on this site all registered users get their own blog on Ajaxonomy and the most interesting posts will be published to the home page.
Delicious
Digg
StumbleUpon
Propeller
Reddit
Magnoliacom
Newsvine
Furl
Facebook
Google
Yahoo
Technorati
Icerocket
Recent comments
11 hours 59 min ago
1 day 12 hours ago
2 days 4 hours ago
2 days 8 hours ago
2 days 20 hours ago
2 days 22 hours ago
6 days 12 hours ago
1 week 2 days ago
1 week 2 days ago
2 weeks 9 hours ago