Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 427 Bytes

Return Negative.md

File metadata and controls

14 lines (9 loc) · 427 Bytes

In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative?

Example:

makeNegative(1); // return -1
makeNegative(-5); // return -5
makeNegative(0); // return 0

Notes:

  • The number can be negative already, in which case no change is required.
  • Zero (0) can't be negative, see examples above.

solution