Stumbled upon an interesting shortcut in JS. To create an object with functions, I used the following code fragment:
var a = { func1: function(){ }, func2: function(){ } }; Somehow I accidentally wrote this:
var a = { func1(){ }, func2(){ } }; That the first, that the second option in function - the same (IMHO). Question: How long has such a reduction been working (there are suspicions that came from ECMA 6)? Is it worth it to cut? Are there any disadvantages of this method?