[Function Call] Many solutions possible, but which one is correct?
alejandroiglesias opened this issue · 0 comments
alejandroiglesias commented
For the Function Call exercise, there are many possible solutions, but I would like to know which ones have fewer drawbacks.
Official solution:
module.exports = Function.call.bind(Array.prototype.slice)
My solution 1:
module.exports = (arr, start, end) => Function.prototype.call.call(Array.prototype.slice, arr, start, end)
My solution 2:
module.exports = (arr, start, end) => Array.prototype.slice.call(arr, start, end)
All three solutions work. Of course the first is the most beautiful and easier to read of the three, but I wonder if other than that there can be technical drawbacks. Also, I think this exercise could be presented earlier in the course since it's not as difficult as the previous one.
Cheers.