ECMAScript: The Fifth Edition - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

ECMAScript: The Fifth Edition

Description:

It is closed to new features. You can still propose features for the Harmony edition. ... It may be adopted by the ECMA General Assembly in December. Interoperability ... – PowerPoint PPT presentation

Number of Views:59
Avg rating:3.0/5.0
Slides: 15
Provided by: douglasc
Category:

less

Transcript and Presenter's Notes

Title: ECMAScript: The Fifth Edition


1
ECMAScriptThe Fifth Edition
  • Douglas Crockford
  • Yahoo! Inc.
  • http//crockford.com/codecamp/next.ppt

2
First new edition since 1999
  • http//wiki.ecmascript.org/doku.php?ides3.1es3.1
    _proposal_working_draft
  • The draft is being finalized.
  • Please review it for correctness.
  • It is closed to new features. You can still
    propose features for the Harmony edition.
  • Testing will begin soon.
  • It may be adopted by the ECMA General Assembly in
    December.

3
Interoperability
  • ECMAScript is already one of the best languages
    when it comes to interoperability. It is getting
    even better.
  • Much less is "implementation dependent".
  • Common practice is now reflected in the standard.
  • Three-out-of-four.

4
Security
  • Strict Mode.
  • Object hardening.
  • Properties can be protected from modification.
  • We still have a global object, so it is still an
    insecure language.
  • A step backwards We now have getters and setters.

5
"use strict"
  • Optional strict mode.
  • Don't use it unless you mean it.
  • Removes some of the most problematic features
    from the language.
  • Limitations on eval, arguments, delete, with
  • This will help improve confidence in Caja,
    ADsafe, and other safety measures.
  • Possible performance benefit.

6
Syntax Relaxation
  • object.for and object.class are now legal.
  • extra "comma", is now legal.
  • 1,2,3,.length 3
  • ltBOMgt is now whitespace.

7
Strings
  • \ltLFgt now allowed in string literals.
  • string.trim()

8
Arrays
  • Array.isArray(array)
  • array.indexOf(searchElement, fromIndex)
  • array.lastIndexOf(searchElement, fromIndex)
  • array.every(func, thisArg)
  • array.some(func, thisArg)
  • array.forEach(func, thisArg)
  • array.map(func, thisArg)
  • array.filter(func, thisArg)
  • array.reduce(func, initialValue)
  • array.reduceRight(func, initialValue)

9
Objects
  • Object.create(object, properties)
  • Object.keys(object)
  • Object.getOwnPropertyNames(object)
  • Object.getPrototypeOf(object)
  • Object.defineProperty(object, name, attributes)
  • Object.defineProperties(object, properties)
  • Object.getOwnPropertyDescriptor(object, name)
  • Object.preventExtensions(object)
  • Object.seal(object)
  • Object.freeze(object)
  • Object.isExtensible(object)
  • Object.isSealed(object)
  • Object.isFrozen(object)

value enumerable
writeable configurable get
set
10
Dates
  • Support for ISO dates.
  • Date.now()
  • date.toISOString ( )

11
Functions
  • function.bind(this, args...)
  • function.apply no longer wraps or replaces its
    this parameter.

12
arguments
  • arguments still isn't an array, but it is more
    array-like.
  • arguments now inherits from Array.prototype, so
    these two statements do the same thing
  • arguments.slice(2)
  • Array.prototype.slice.apply(arguments, 2)
  • arguments is still dangerously linked to
    parameters.

13
Regular Expressions
  • RegExp literals now produce unique objects.
  • \s now describes all of the whitespace characters
    recognized by the language.
  • /// is now legal.

14
JSON
  • JSON.parse(text, reviver)
  • JSON.stringify(value, replacer, indent)
  • http//www.json.org/json2.js
  • http//wiki.ecmascript.org/doku.php?ides3.1es3.1
    _proposal_working_draft
Write a Comment
User Comments (0)
About PowerShow.com