Anybody knows if it is possible to get a
javascript for/in loop
from coffeescript?
Actually would like to write the js function
function logobject(o) {
for (p in o)
console.log(p + "=" + o[p])
}
in coffeescript.
As of today, January 2020, CoffeeScript is completely dead on the market (though the GitHub repository is still kind of alive).
CoffeeScript is a programming language that compiles to JavaScript. It adds syntactic sugar inspired by Ruby, Python, and Haskell in an effort to enhance JavaScript's brevity and readability. Specific additional features include list comprehension and destructuring assignment.
CoffeeScript is a lightweight language that compiles into JavaScript. It provides simple and easy to learn syntax avoiding the complex syntax of JavaScript.
In general, we use parenthesis while declaring the function, calling it, and also to separate the code blocks to avoid ambiguity. In CoffeeScript, there is no need to use parentheses, and while creating functions, we use an arrow mark (->) instead of parentheses as shown below.
console.log "#{k}=#{v}" for k, v of o
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