I discovered this by accidentally leaving the function keyword. Usually the foobar method in the module below will be declared as foobar: function(arg1) , but it is interesting that this works, at least in some browsers, for example. Chrome version 44.0.2403.157 m, but it does not work in IE 11.0.9600.17959
How is it possible that this generally works in any browser? Is this some kind of new ES6 functionality?
var module = { foobar(arg1) { alert(arg1); } }; module.foobar("Hello World");
javascript function methods ecmascript-6
George Jempty Sep 04 '15 at 18:39 2015-09-04 18:39
source share