Array.prototype.newMethod=function () {
for (let foo=0;foo<this.length;foo++)
{
this[foo]=this[foo]/2;
}
return this
};
console.log([1,2,3,4,5,6,7].newMethod());
/*return: [0.5, 1, 1.5, 2, 2.5, 3, 3.5]*/
class UpgradeList(list):
def up_lst(self):
return [x.upper() for x in self]
a = UpgradeList(['test', 'cake', 'sake', 'voka'])
print(a.up_lst())