Y
Hacker News
new
|
ask
|
show
|
jobs
by
rlkf
609 days ago
(x === 1) && console.log("it's 1")
Note that you've saved exactly no keystrokes, although this is composable into expressions (if you are using some Javascript-derivative; in ML it would typically already be using the if-form).
2 comments
eacnamn
609 days ago
((x == 1)) && printf 'it'"'"'s 1\n' although I'm not sure how useful this actually is, but it is a nice-to-know
link
andrewstuart
608 days ago
or
x === 1 && console.log("it's 1");
link