Currently I'm using:
input = input ? input : 'splash';
which I know is too verbose.
What is the shorter way to do this?
Currently I'm using:
input = input ? input : 'splash';
which I know is too verbose.
What is the shorter way to do this?
You can use the 'logical OR assignment' and make it even shorter:
input = input || 'splash';
If the input is Truthy value then its will take it, otherwise its will take 'splash'.
You could try this using the or operator:
var input = 'input';
var input2 = false;
var splash = 'splash'
input || splash // logs input
input2 || splash // logs splash