In JavaScript, you can make a right-variadic function by gathering parameters. For example:
const abccc = (a, b, ...c) => {
console.log(a);
console.log(b);
console.log(c);
};
abccc(1, 2, 3, 4, 5)
In JavaScript, you can make a right-variadic function by gathering parameters. For example:
const abccc = (a, b, ...c) => {
console.log(a);
console.log(b);
console.log(c);
};
abccc(1, 2, 3, 4, 5)
something = if condition | |
value-if-truthy | |
else | |
value-if-falsy |
const SecretDecoderRing = { | |
encode: function (plaintext) { | |
return plaintext | |
.split('') | |
.map( char => char.charCodeAt() ) | |
.map( code => code + 1 ) | |
.map( code => String.fromCharCode(code) ) | |
.join(''); | |
}, | |
decode: function (cyphertext) { |
JavaScript Allongé has over 400 pages and many photographs. For this reason, the .mobi
version of the book is too big to be sent to your Kindle via email.
If you wish to read JavaScript Allongé on your Kindle, please:
let Person = (() = > { | |
let firstNameProperty = Symbol('firstName'), | |
lastNameProperty = Symbol('lastName'), | |
renameMethod = Symbol('rename'); | |
return class Person { | |
constructor (first, last) { | |
this[renameMethod](first, last); | |
} | |
fullName () { |
# See https://twitter.com/fogus/status/623312803345117184 | |
def meth a, b, c | |
[yield(a), yield(b), yield(c)] | |
end | |
meth(1, 2, 3) { |x| x * x } | |
# => [1, 4, 9] | |
arr = [1962, 6, 14, lambda { |x| x.to_s }] |
Many an idea or concept not only looks, but is good in its infancy, yet turns destructive later in life. Scaling and maturation are not the obvious processes they appear to be because they take so much time that the accumulated effort is easy to overlook.
To be successful, they must also be very carefully guided by people who can envision the end result, but that makes it appear to many as if it merely "happens." Take a good idea out of its infancy, let it age without guidance so it does not mature, and it generally goes bad.
const evenStevens = (n) => { | |
if (n === 0) { | |
return true; | |
} | |
else if (n == 1) { | |
return false; | |
} | |
else { | |
n = n - 2; | |
return evenStevens(n); |
Dear soon-to-be-former user, | |
We've got some fantastic news! Well, it's great news for us anyway. You, on | |
the other hand, are fucked. | |
We've just been acquired by: | |
This CoffeeScript: | |
name = 'clyde' | |
do -> | |
"Hello #{name}" for name in ['algernon', 'sabine', 'rupert', 'theodora'] | |
name | |
Complies to this on CoffeeScript under Node: | |
(function() { |