Array.prototype.newSlice = function(x,y) {
return this.slice(x,y)
}
String.prototype.newSlice = function(x,y) {
return this.substring(x,y)
}
class LottoTicket {
constructor(...nums) { this.nums = nums }
newSlice(x,y) { return this.nums.slice(x,y) }
}
const newSlice = (x,y) => F => F.newSlice(x,y)
console.log(newSlice(1,2)([1,2,3,4]))
console.log(newSlice(1,2)("abcd"))
console.log(newSlice(1,2)(new LottoTicket(9,8,7)))
console.log([1,2,3,4].newSlice(1,2))
console.log("abcd".newSlice(1,2))
console.log((new LottoTicket(9,8,7)).newSlice(1,2))