ECMAScript 4
Recently I have been reading over the ECMAScript 4 language overview whitepaper to see what tasty things are in it. There are some really great features, one being able to create classes. Here is a real basic example…
// A property
var url;
// Constructor
function Website(_url){
url = _url;
}
// Getter
function get webURL(){
return url;
}
// Setter
function set webURL(_url){
url = _url;
}
}
// Lets extend it
class Feed extends Website {
var desc;
var feed;
function Feed(_feed, _desc){
desc = _desc;
feed = _feed;
}
function getFeed(){
return feed;
}
function getDesc(){
return desc;
}
}
…and running it the interpreter…
>> var website = new Website("http://blogs.pixeldepth.net/Peter/");
>> website.webURL
http://blogs.pixeldepth.net/Peter/
>> var feed = new Feed("http://blogs.pixeldepth.net/Peter/feed", “Recent posts");
>> feed.getFeed()
http://blogs.pixeldepth.net/Peter/feed
>> feed.getDesc()
Recent posts
Cool stuff, and it doesn’t stop there. I would recommend checking out John Resig’s blog, he has been posting about ECMAScript alot lately. Here are his slides from one of his talk…
For more info, have a read of John’s blog…
3 Comments to ECMAScript 4
Leave a comment
What Am I Doing?
- Installed W@W 1.02 patch, should now be able to play with American friends, let the desync commence
- Just finished playing World at War, can now connect to people. Spawning is really bad, a very high chance of being shot in the back.
- Still can't connect to anyone on World at War multiplayer, but people can connect to me, very annoying.
- Finished Call of Duty World at War single player, felt shorter than Modern Warfare. Now I can play Zombie mode.
- Played Call of Duty World at War, at the moment I'm not keen on it, WWII doesn't do it for me. I'll keep playing, might start to like it.
- Yay, I got news that Call of Duty World at War has been delivered from Game.
- Just finished playing Call of Duty 4, which could be the last time, as W@W should arrive tomorrow.
- At work
- Played some CoD4 before work, my team was really bad
- Downloading Ubuntu, Vista is horrible to develope on
- On my way home through the lovely rain on my bike
- Completed Far Cry 2 at the weekend
- Installed Twinkle app on touch, awesome for a free app
- Setting up Twitter on my Ipod Touch
Search
Categories
- Browsers (14)
- Gaming (19)
- General (103)
- ProBoards (12)
- Programming (97)
- Adobe AIR (18)
- JavaScript (37)
- pDBB (8)
- PHP / MySQL (9)
- PHP-GTK (4)
- Videos (16)
- Work (4)
Recent Comments
Tags
2032 actionscript adobe africa alive air airpacker browser cod COD4 css dean edwards ds easing eric schmidt error explorer ext facebook file Firefox flickr Gaming google htaccess ie input internet JavaScript mime nintendo packer penner perl pleasurewood hills poignant PS3 robert ruby safari scrollovers testing theme park wii wordpress xboxArchives
- October 2008 (6)
- September 2008 (3)
- August 2008 (2)
- June 2008 (4)
- May 2008 (2)
- April 2008 (1)
- March 2008 (5)
- February 2008 (3)
- January 2008 (1)
- December 2007 (3)
- November 2007 (6)
- October 2007 (5)
- September 2007 (13)
- August 2007 (7)
- July 2007 (5)
- June 2007 (9)
- May 2007 (17)
- April 2007 (10)
- March 2007 (19)
- February 2007 (27)
- January 2007 (19)
- December 2006 (4)
- November 2006 (4)
- October 2006 (15)
- September 2006 (14)
- August 2006 (12)
- July 2006 (9)
- June 2006 (12)
I’m not sure how different that presentation is from the one Eich gave a year or so ago on JS2.0 and the lead-up to it, but hadn’t noticed packages were in it before. Still a couple of years away though, and I’m guessing uptake won’t be brilliant til IE9/IE10?
Been keeping up to date on things recently, and have been reading the debate…
Link
Link
Sounds pretty cool, I had a look at the site and it seems to have a lot implented.
I’m probably not going to use it because I hardly ever do js, but I’m still gonna try it out
Thanks for the link.