So I have a bit of a problem, here is the basic version.
var x = 10;
(x < 5) ? call() : "" ;
function call() {
alert('Less');
}
I want a way to give the question mark if statement "nothing" to do if it finds something to be false. Is what I am doing a legal move in JavaScript? Is there a better way to give the if "nothing" to do if it finds this false? The console does not catch any errors.
However when I tried:
var x = 10;
(x < 5) ? call() :;
function call() {
alert('Less');
}
It gave me an Error as well as:
var x = 10;
(x < 5) ? call();
function call() {
alert('Less');
}
Specifically what I am asking is: Is there a proper syntax to the question mark if to make it work without the else part? Thanks in advance.