And also what is the version of SpiderMonkey it is using, and what version of firefox uses that same version?
I want to know what features of javascript I can and can not use in cocos. (Like for…of, Maps, arrow functions like ( )=>“asd”, etc)
And also what is the version of SpiderMonkey it is using, and what version of firefox uses that same version?
I want to know what features of javascript I can and can not use in cocos. (Like for…of, Maps, arrow functions like ( )=>“asd”, etc)
I manually tried modernizr in a game, and touched it a little to know exactly what javascript features cocos do and do not support.
It seems that it supports ES5 pretty well, and a lot of ES6 features. In fact it seems to support the vast majority of tests, but for the record, these are the things that you cannot do on cocos2d-js (at least on 3.9)
Array.prototype.values
WeakSet
typeObject.assign
window.Promise
doesn’t existString.raw
String.includes
(can use String.contains instead which does the same)But all the other nice stuff like Map, Set, arrow functions, optional and rest parameters, etc, works flawlessly.
PS: Also, something interesting is that firefox has a unique .watch() function for objects that also works on cocos, it is intended for debugging purposes, but it is an interesting option for making two way data binding in cocos.