Skip to content

Commit 6965c53

Browse files
committed
Make Negative if positive.
1 parent 3ec3ad1 commit 6965c53

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

MakeNegative.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
// We're going to use a ternary operator that checks if the number is negative.
66
// if it is, return the number, else return the negative number.
7+
8+
/*
9+
In JavaScript, to make a variable negative, we can just put a negative sign in front.
10+
*/
711
const makeNegative = number => {
812
return (number < 0) ? number: -number
913
}

0 commit comments

Comments
 (0)