JSFiddle - React, Tailwind, and code Playground
HTML
<div>
</div>
JavaScript
function test1(a,b)
{
return
a && a == 1 && b && b.match(/abc/i) ?
a + 1 :
0;
}
function test2(a,b)
{
var val =
a && a == 1 && b && b.match(/abc/i) ?
a + 1 :
0;
return val;
}
alert(test1(1,'abc')); // returns undefined when it should return 2
alert(test2(1,'abc')); // returns 2 as expacted