So I started learning Javascript.
They say that once you understand basic coding principles, learning a new programming language is mostly a matter of figuring out syntax and getting used to whatever special tricks that language has to offer. It certainly seems to be the case with this Ruby to JS transition.
But I certainly miss the syntactic sugar that Ruby gives us – and what is with all the curly brackets and the semicolons?!
Consider Project Euler Problem I (summing up multiples of 3 and 5 from 1 to 999).
There is just so much we can do with it in Ruby:
And here comes JavaScript:
But just like mastering a foreign language that allows one to express oneself in a new and expanded way (as an example, google ‘toska’ and ‘Nabokov’ – Russians take melancholy to a whole new level that does not exist in any other language), JavaScript offers something pretty cool: for (var x = 0; x < 1000; x++) – now that is one handy way to guide one’s iteration. I sort of wish Ruby had that…
But for now, I need a T-shirt that says ‘I don’t really like semicolons.’