I am trying to learn how can i return in expressions, it might be impossible but any close solution can be helpfull
var something = ()=>{ (true) && (return true) } console.log(something())
Advertisement
Answer
and is a logical operator , it checks the logic and return the bool value .you cannot use return statement within logical operator.In that place (just to look cool) you can use ternary operator for example:
var something = ()=>{ num=4; return (num === 4) ? "Correct!": "Incorrect!"; } console.log(something())