The fat arrow is a feature of ES6 (now officially called ECMAScript 2015). It's been introduced in Firefox but not yet in other browsers (and especially not completely in V8 which would be interesting for nodejs/iojs development).
As it's mostly sugar, you'd better wait before using it.
If you need the scope binding (this
is the same in the function call and in the scope in which the function was defined, we speak of "lexical this"), then instead of
$("#test").on("click", () => {
some code
});
you can simply do
$("#test").on("click", (function() {
some code
}).bind(this));
If you don't (as in your example), then simply do
$("#test").on("click", function() {
console.log("test");
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…