this is from the Use Multiple Conditional (Ternary) Operators challenge;
thanks
function checkSign(num) {
return (num === (num)) ? "positive"
: (num === (-(num))) ? "negative"
: "zero";
}
checkSign(10);
this is from the Use Multiple Conditional (Ternary) Operators challenge;
thanks
function checkSign(num) {
return (num === (num)) ? "positive"
: (num === (-(num))) ? "negative"
: "zero";
}
checkSign(10);
this is always true, a number is always equal to itself
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
ok thanks for the correction.
Also aside from
num < 0 ? "negative"
Which other way can one check a number is negative or not?
why do you need a different way?
but you could use Math.abs to do what you were trying to do there
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs
you could raise a number to the power of that number, with Math.pow, if the result is less than one the number you need to check is negative
was curious 
thanks tho