Automotive
Improved ECMAScript 2015 (ES6) support
This release of V8 provides support for two well-known symbols, built-in symbols from the ES2015 spec that allow developers to leverage several low-level language constructs which were previously hidden.@@isConcatSpreadable
The name for a Boolean valued property that if true indicates an object should be flattened to its array elements by Array.prototype.concat.(function(){
"use strict";
class AutomaticallySpreadingArray extends Array {
get [Symbol.isConcatSpreadable]() {
return true;
}
}
let first = [1];
let second = new AutomaticallySpreadingArray();
second[0] = 2;
second[1] = 3;
let all = first.concat(second);
// Outputs [1, 2, 3]
console.log(all);
}());
@@toPrimitive
The name for a method to invoke on an object for implicit conversions to primitive values.(function(){
"use strict";
class V8 {
[Symbol.toPrimitive](hint) {
if (hint === 'string') {
console.log('string');
return 'V8';
} else if (hint === 'number') {
console.log('number');
return 8;
} else {
console.log('default:' + hint);
return 8;
}
}
}
let engine = new V8();
console.log(Number(engine));
console.log(String(engine));
}());
ToLength
The ES2015 spec adjusts the abstract operation for type conversion to convert an argument to an integer suitable for use as the length of an array-like object. (While not directly observable, this change might be indirectly visible when dealing with array-like objects with negative length.)V8 API
Please check out our summary of API changes. This document gets regularly updated a few weeks after each major release.Developers with an active V8 checkout can use 'git checkout -b 4.8 -t branch-heads/4.8' to experiment with the new features in V8 4.8. Alternatively you can subscribe to Chrome's Beta channel and try the new features out yourself soon.
Posted by the V8 team