ecma - Dave's Blog

Search
My timeline on Mastodon

Creating type-safe properties with ECMAScript 6 proxies | NCZOnline

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.

PermalinkCommentstechnical javascript es6 proxies

JavaScript Array methods in the latest browsers

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.
PermalinkCommentsjavascript array technical programming

Evolving ECMAScript

2011 Nov 24, 4:44PermalinkCommentstechnical javascript programming

John Resig - ECMAScript 5 Strict Mode, JSON, and More

2010 Oct 6, 7:35Layman summary of ECMAScript 5 strict mode.PermalinkCommentsecma es5 strict js javascript json reference security technical article john-resig

Chromium Blog: Does Your Browser Behave?

2010 Mar 12, 7:56A tool to run Google's ECMA conformance test suite on your browser.PermalinkCommentschrome web browser javascript technical tool test google
Older Entries Creative Commons License Some rights reserved.