How to calculate the cube of a number in Node.js

1 Answer

0 votes
function cube(n) {
    return Math.pow(n, 3);
}
 
let n = cube(2);
console.log(n);
  
console.log(cube(3));
  
n = cube(4);
console.log(n);
  
 
            
  
/*
run:
    
8
27
64
      
*/

 



answered May 21, 2024 by avibootz
edited May 21, 2024 by avibootz

Related questions

1 answer 121 views
1 answer 168 views
1 answer 130 views
1 answer 103 views
103 views asked Nov 16, 2022 by avibootz
1 answer 116 views
2 answers 188 views
...