← Back to challenges

Return Negative

JavaScriptMediumnumberslogiclanguage_fundamentals

Instructions

Create a function that takes a number as an argument and returns negative of that number. Return negative numbers without any change.

Examples

returnNegative(4) ➞ -4

returnNegative(15) ➞ -15

returnNegative(-4) ➞ -4

returnNegative(0) ➞ 0

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Learn Lodash: _.drop, Drop the First Elements of an Array