2014 Apr 30, 9:12
Clearly the one JS feature we all agree on is ubiquity.
After some experimentation, I discovered that it’s possible to add type safety to JavaScript objects [via ES6 proxies] with just a few lines of code.
technical javascript es6 proxies 2011 Dec 3, 6:46
Cool and (relatively) new methods on the JavaScript Array object are here in the most recent versions of your
favorite browser! More about them on ECMAScript5, MSDN, the IE blog, or Mozilla's documentation. Here's the list that's got me excited:
-
some & every
-
Does your callback function return true for any (some) or all (every) of the array's elements?
-
filter
-
Filters out elements for which your callback function returns false (in a new copy of the Array).
-
map
-
Each element is replaced with the result of it run through your callback function (in a new copy of the Array).
-
reduce & reduceRight
-
Your callback is called on each element in the array in sequence (from start to finish in reduce and from finish to start in reduceRight) with the result of the previous callback call passed to
the next. Reduce your array to a single value aggregated in any manner you like via your callback function.
-
forEach
-
Simply calls your callback passing in each element of your array in turn. I have vague performance concerns as compared to using a normal for loop.
-
indexOf & lastIndexOf
-
Finds the first or last (respectively) element in the array that matches the provided value via strict equality operator and returns the index of that element or -1 if there is no such element.
Surprisingly, no custom comparison callback method mechanism is provided.
-
javascript array technical programming 2010 Mar 12, 7:56A tool to run Google's ECMA conformance test suite on your browser.
chrome web browser javascript technical tool test google