myarray.includes is not a function
leumasme opened this issue ยท 4 comments
myarray = new Array;
myarray.push("pls","send","help");
myarray.includes("pls");
->myarray.includes is not a function[...]
Tested same thing in Browser AND NodeJS, works fine
+1 What @Gloorf said. includes
is an ES6 function. ScriptCraft depends on the Javascript engine provided by the Java Runtime. Right now, Java doesn't have full support for ES6 (the latest version of Javascript) so some functions and features of ES6 will be missing.
found a workarround by adding
Array.prototype.includes = function(t){return this.indexOf(t)!="-1"}
to the start of the file to manually re-add the function of .includes, still think this should be fixed
Array.prototype.includes is an ECMASCript6 feature ; ES6 support in nashorn (java's JS engine) can be found (partially, it seems not everything is supported yet) in java 9. See here for more informations