+ 2
JavaScript Math methods/functions 😭
var num = -50 console.log(abs(num)); /* console.log(ceil(num)); console.log(cos(num)); console.log(pow(5, 2)); console.log(sqt(num)); console.log(tan(num)); console.log(sin(num)); */ /*output is "Uncaught ReferenceError: abs is not defined " can someone explain why?? */
2 ответов
+ 5
abs() function is defined in Math object.
You have to say Math.abs();
For example:
console.log(Math.abs(num));
reference: https://www.sololearn.com/learn/JavaScript/1243/