15 lines
304 B
Markdown
15 lines
304 B
Markdown
importance: 2
|
|
|
|
---
|
|
|
|
# Show the sign
|
|
|
|
Using `if..else`, write the code which gets a number via `prompt` and then shows in `alert`:
|
|
|
|
- `1`, if the value is greater than zero,
|
|
- `-1`, if less than zero,
|
|
- `0`, if equals zero.
|
|
|
|
In this task we assume that the input is always a number.
|
|
|
|
[demo src="if_sign"]
|