I am learning Javascript, and I am trying to go over everything I have learned so far. I am trying to figure out how to get a message back like an alert box when using the return statement. alert(Example(2,3)); works, also making a gobal variable like this works. var sum = Example(2,3); alert(sum);. But I bet there are better ways then I can think of.
function Example(x, y) {
if (x * y === 108) {
return true;
} else {
return false;
}
}
Example(2, 3);
sumwhen its value is either true or false.