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:
S
Shyam Dubey     View Profile
If you are good in any field. Just share your knowledge with others.