You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const validNumber = +num // converted to number, also can use - Number(num)
if (Number.isNaN(validNumber) || typeof num === 'object') {
throw new TypeError('Argument is NaN - Not a Number')
}
return validNumber < 0 ? -validNumber : validNumber // if number is less than zero mean negative then it converted to positive. i.e -> n = -2 = -(-2) = 2