ecma

Why did ECMASCRIPT 6 reverse the sides for assignment when destructuring? [closed]

我怕爱的太早我们不能终老 提交于 2019-11-29 16:07:24
Why did ES6 decide that left-side assignment made more sense or was more useful for destructured assignments? Just on first look, it seems to make code more error prone, now that assignment can happen on both sides, depending on situation. let obj = { first: 'Jane', last: 'Doe' }; let { first: f, last: l } = obj; // f = 'Jane' // l = 'Doe' f and l are both seemingly being defined on the left, using values from a combination of the var names on the left and values of those vars from the right. Given that the rationale for this sytax is the keep it the same as object declaration syntax, why

Which Edition of ECMA-262 Does Google Apps Script Support?

不想你离开。 提交于 2019-11-26 18:53:44
According to this thread from the old Google Group, Apps Script is based on ECMA-262 3rd Edition. This would seem to be supported by the fact that auto-completion in the editor displays 3rd Edition array functions. However the following code runs perfectly well, which casts doubt on the matter: var array = [ 1,2,3,4,5 ]; Logger.log("forEach:"); array.forEach(function (item,idx,arr) { Logger.log(item); }); Note the use of ECMA-262 5th Edition Array function forEach. Would someone authoritative mind giving a definitive answer on why this is the case? And whether it's safe to rely on all 5th

Which Edition of ECMA-262 Does Google Apps Script Support?

不羁的心 提交于 2019-11-26 06:39:22
问题 According to this thread from the old Google Group, Apps Script is based on ECMA-262 3rd Edition. This would seem to be supported by the fact that auto-completion in the editor displays 3rd Edition array functions. However the following code runs perfectly well, which casts doubt on the matter: var array = [ 1,2,3,4,5 ]; Logger.log(\"forEach:\"); array.forEach(function (item,idx,arr) { Logger.log(item); }); Note the use of ECMA-262 5th Edition Array function forEach. Would someone