Skip to content

2695-array-wrapper

DevGod
DevGod
Vtuber
/**
* @param {number[]} nums
* @return {void}
*/
var ArrayWrapper = function(nums) {
this.myNums = nums;
};
/**
* @return {number}
*/
ArrayWrapper.prototype.valueOf = function() {
return _.sumBy(this.myNums);
}
/**
* @return {string}
*/
ArrayWrapper.prototype.toString = function() {
return "["+this.myNums.toString()+"]";
}
/**
* const obj1 = new ArrayWrapper([1,2]);
* const obj2 = new ArrayWrapper([3,4]);
* obj1 + obj2; // 10
* String(obj1); // "[1,2]"
* String(obj2); // "[3,4]"
*/