13. Function Review


#1

In this lesson Codecademy gives an example of a function called Square:

var square = function (x) {
  return x * x;
};

Is there a built-in JavaScript function that squares a number? (example 2^2)


#2

you can use ** for calculating exponentiation.

console.log(3**3)

or is that not what you mean?


#3

Ok, so that would evaluate to 27, right?


#4

well, its code, you can run it? Yes, that would indeed output 27


#5

Alright, thanks @stetim94!


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.