copySign
Returns the absolute value of the first number, but the sign of the second.
- Use Math.sign()to check if the two numbers have the same sign.
- Return xif they do,-xotherwise.
Returns the absolute value of the first number, but the sign of the second.
Math.sign() to check if the two numbers have the same sign.x if they do, -x otherwise.