HTML and CSS Reference
In-Depth Information
return ==
"[object Array]";
return isArray;
In addition to the static isArray method, Array.prototype defines a
host of new methods: indexOf , lastIndexOf , every , some , forEach , map ,
filter , reduce , reduceRight .
8.5 Summary
In this chapter we have taken a brief look at some changes in JavaScript's (hopefully)
near future. ECMAScript 5 brings the spec up to speed with innovation in the wild
and even brings some exciting new features to the language. Setting the course for
future standards—specifically ECMAScript Harmony, the working group for the
next revision to the language—ES5 introduces strict mode, opt-in deprecation of
troublesome features from JavaScript's childhood.
Extensions to objects and properties open the door to interesting new ways
of structuring JavaScript programs. JavaScript's prototypal nature no longer needs
to be hidden behind class-like constructors, because new Object methods make
working with prototypal inheritance easier and clearer. By finally allowing develop-
ers to both read and write property attributes, even for user-defined objects, ES5
enables better structured and more robust programs, better encapsulation, and
immutable objects.
An overview of ES5, even as selective as here, can guide us in writing code
that will more easily port to it once it's widely adopted. We will draw from this
inspiration in the TDD examples in Part III, Real-World Test-Driven Development
in JavaScript. Before we dive into those examples, however, we will learn about
unobtrusive JavaScript and feature detection in the closing two chapters of Part II,
JavaScript for Programmers.
Search WWH ::

Custom Search