Skip to content

@timaschew /js2coffee.org.js
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
demo snippest of js2coffee talk at Berlin Node.js Meetup #3 - 2014-03-12 - try it out on http://js2coffee.org
// buggy when switch multiple times (js2coffee, coffee2js, js2coffee, ...)
foo = "bar"
// avoid the bug
main.foo = "bar";
// example for variable shadowing
var x = 0;
main.f = function(err, res) {
var x = 1;
};
// existence operator
if (main.foo != null) {
qux();
}
// inversible operators
if (foo && bar !== true || anything()) {
qux();
} else {
baz();
}
// show later in the slides (ternary operator) how this would be converted with js2coffee
main.foo = boolVal ? "yes" : "no";
// pretty print for complex object structures
main.x = {
foo: 1,
bar: 2,
nested: {
foo: 3,
bar: 4
},
array: [
1, 2, {
foo: 1
}, {
bar: 2
}
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.