Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)?

like image 533
Alan Avatar asked Mar 08 '23 06:03

Alan


1 Answers

This documentation would have me believe that you can get ES6 even in Java 8 by using -Dnashorn.args=--language=es6:

https://developer.oracle.com/databases/nashorn-javascript-part2

Indeed, I managed to get some basic ES6 support from Clojure (adding :jvm-opts ["-Dnashorn.args=--language=es6"] to project.clj), though I was still not able to load the library I wanted, so there may indeed still be pieces missing.

like image 195
metasoarous Avatar answered Mar 16 '23 20:03

metasoarous