# Application of anonymous functions object in JavaScrip

Let's make an object with two functions, each of them will take a number as a parameter. Let the first function square the passed number, and the second function cube. An implementation:

`let math = { square: function(num) {return num * num}, cube: function(num) {return num * num * num}, };`

Let's use our functions:

`let math = { square: function(num) {return num * num}, cube: function(num) {return num * num * num}, }; console.log( math.square(2) ); // shows 4 console.log( math.cube(2) ); // shows 8`

Make an object with three functions, each of them will take an array of numbers as a parameter. Make the first function return the sum of the array elements, the second function return the sum of squares, and the third return the sum of cubes.

← →
↑
en ru