New course! Every coder should learn Generative AI!
Try a free lesson+ 1
function turnToNegative(num) { // turn to negative }
Help me to complete the code
7 Answers
+ 1
function turnToNegative(num) {
return -Math.abs(num)
}
+ 6
if the number is larger than 0, you get the negative number by multiplying with -1
+ 4
Show what you have tried.
Give a COMPLETE task description.
+ 2
How to link a code:
Go to Code section, click +, select the programming language, insert your code, save.
Come back to this thread, click +, Insert Code, sort for My Code Bits, select your code.
+ 2
What is the task?
You need to call the function. You need to output the result to the console.
+ 1
I have tried your logic but it was not accurate