Warping it up!

Fini Alring's Glossy Tech Zine

Archive for August 19th, 2005

Mozilla: New JS Array Methods

Friday, August 19th, 2005

As an “old-schoolJavaScript hacker, I dreadfully remember the days before the Array() object. Not that we didn’t survive without it, but it’s good to have this sort of stuff properly implemented in a language..

After a whole lot of silence (not forgetting the yet to be publicized E4X) in the land of JavaScript / ECMAScript finally something is happening to the Array spec, Mozilla has added new methods which will be publicly available in Firefox 1.5. However I have not been able to locate the draft specification of EMCA-262 and thus I can not confirm if these methods are actually in the coming ECMA-262 Edition 4.

These are the new Array methods:

Item location methods:
indexOf( )
Returns the index of the given item’s first occurrence.
lastIndexOf( )
Returns the index of the given item’s last occurrence.
Iterative methods are:
every( )
Runs a function on every item in the array and returns true if the function returns true for every item.
filter( )
Runs a function on every item in the array and returns an array of all items for which the function returns true.
forEach( )
Runs a function on every item in the array.
map( )
Runs a function on every item in the array and returns the results in an array.
some( )
Runs a function on every item in the array and returns true if the function returns true for any one item.

Visit webreference.com for examples on how to use these methods.

Mozilla’s New Array Methods – WebReference.com

E=MC2 100 year anniversary

Friday, August 19th, 2005

Eric Ward writes “To mark the one hundredth anniversary of Einstein’s famous equation, E=mc2, NOVA has gone live this month with a Web site that features exclusive content and podcasts from ten of the worlds top physicists. This once-in-a-lifetime gathering of top scientists such as S. James Gates, Jr., Brian Greene, Neil deGrasse Tyson and Nobel Laureate Sheldon Glashow simplify what the equation means to our world today and the effect it has had on their careers. NOVA online also details how Einstein grappled with the implications of his revolutionary theory of relativity and came to a startling conclusion: that mass and energy are one, related by the formula E=mc2. Viewers will also find lesson plans through the award-winning NOVA Teacher’s Guide and a special library resource kit.”

Slashdot | One Hundred Years of E=MC2