javascriptnashorn

ECMA 6 support in Nashorn


I just tried out Nashorn and it seems not to support Array.prototype.fill. Is this surprising? Is there a timeline somewhere for Nashorn's intended support? Is the best way to get an array of say 5 0s in Nashorn currently Array.apply(null, Array(5)).map(x=>0)?


Solution

  • Seems there is partial support for ES6 in Java9 and more coming later: https://www.oracle.com/corporate/features/nashorn-javascript-engine-jdk9.html

    Also see: http://openjdk.java.net/jeps/292