How to implement JavaScript Interview Question | Problem Solving | JavaScript Polyfills
@Yomesh Gupta

In this question, the candidate needs to implement a function customAt that mimics the behaviour of method.

More about

The at() method takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array.


const array = [5, 12, 8, 130, 44];

console.print(array.customAt(2)); // prints 8
console.print(array.customAt(-1)); // prints 44
console.print(array.customAt(100)); // prints undefined


Start the timer, complete your solution, and test it against the testcases provided by the platform. Ideally, you should finish this question within 15 mins. Share your solution with us --

Loading IDE...