First of all, I think your JavaScript should look like this:
categories = [{"code": "zzz", "title": "Electronics"}, {"code": "yyy", "title": "Cars"}];
You need an array, right? Then CoffeeScript, well, in exactly the same way (without an end semicolon, but this is also optional in JavaScript):
categories = [{"code": "zzz", "title": "Electronics"}, {"code": "yyy", "title": "Cars"}]
At the top of the Github CoffeeScript page is a TRY COFFEESCRIPT button , which may be useful for such things.
source share