In javascript, how do you declare a variable and set its value to the result of a function in a single line?
In pseudo-code, what I am trying to achieve is this:
var coinToss = if(Math.random() < 0.5), assign value of "tail" to my variable, otherwise, assign value of "head" to my variable.
I could do this is a block of code, but I assume that there must be a way to achieve the result in a single line?
Many thanks in advance,