In JS I have
$("#index").on({
click : function() { // do something useful with $(this)....}
},"li.superclass");
How I can describe this with CoffeeScript?
In summary, CoffeeScript began as a fantastic idea (making it easier to write JavaScript code) ultimately, however, it did not stand the test of time and was pushed out by JavaScript and currently, hardly anyone remembers about it.
CoffeeScript is a lightweight language that compiles into JavaScript. It provides simple and easy-to-learn syntax avoiding the complex syntax of JavaScript. CoffeeScript is influenced by JavaScript, Ruby, YAML, Haskell, Perl, Python and has influenced MoonScript, LiveScript, and JavaScript.
Advantages of CoffeeScript Using CoffeeScript, we can write clean, clear, and easily understandable codes. Write less do more − For a huge code in JavaScript, we need comparatively very less number of lines of CoffeeScript. Reliable − CoffeeScript is a safe and reliable programming language to write dynamic programs.
Easy to Understand: The syntax of this language is a simple form of JavaScript. The simplicity of the syntax is the beauty of this programming language. The code written in CoffeeScript is very clean and easily understood.
It's almost the same:
$("#index").on click: ->
alert ("hi")
, "li.superclass"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With