number square n times in typescript

The solution for “number square n times in typescript” can be found here. The following code will assist you in solving the problem.

Math.pow(x1, 2)
x1 * x1
x1 ** 2 // ES6 syntax

function square(firstNumber: number, secondNumber: number):number{
return firstNumber ** secondNumber
}

// For example
console.log(square(4,2))

//output.:

16

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in