Is the following function legal and portable?
function(_, _, x){
return x;
}
Sometimes I want to write a callback that doesn’t use the leftmost parameters so I wonder what is the most concise way to do so.
Conclusion:
function(_1, _2, x) is probably as short as it gets then.
It is valid in non-strict mode code, but invalid in strict mode code:
Source: http://es5.github.com/#x13.1
Therefore, you may want to avoid this, since at one point in the future you will want to move on to strict mode…