You are here: Home / Topics / Write a code to print Cubes of any number in JavaScript

Write a code to print Cubes of any number in JavaScript

Filed under: JavaScript on 2023-08-06 20:48:07

In this program, we will make a function cubes(number) which will take number as parameter and will return cube of that number.

cubes(3) ➞ 27
cubes(5) ➞ 125
cubes(10) ➞ 1000

<script>

function cubes(number){

return number ** 3; //** means power 

}

</script>

About Author:
M
Mr. Dubey     View Profile
Founder and CEO of MCQ Buddy. I just like to help others. This portal helps students in getting study material free.