Course · Section 2: JavaScript Fundamentals – Part 1 · Lecture 13: Basic Operators
Implement `sign(n)` returning `-1`, `0`, or `1` for negative, zero, and positive numbers using a ternary expression.
+ 1 hidden test run on Submit.
A nested ternary maps positive to 1, negative to -1, and zero to 0.
Run your code to see results.