While writing shorthand if-else in javascript,getting syntax error. Here is my code:
data && data.cod == '404' && return;
Although works fine when I use normal if-else like below:
if(data && data.cod == '404') {return};
var temp = data && data.main && data.main.temp;
//Code here...
I know, it works fine if I use ternary operator like return (data && data.cod == '404')?'true':'false';
but I'm looking return on conditional basis otherwise continue further.