const arr = [3, 1.5, 9, 2, 5.2]; arr.sum = function() { return this.reduce((a, x) => a+x); } arr.avg = function() { return this.sum()/this.length; } Object.defineProperty(arr, 'sum', { enumerable: false }); Object.defineProperty(arr, 'avg', { enumerable: false }); console.log(arr.sum()); // 20.7 console.log(arr.avg()); // 4.14