I want to write a program to get nth element of given array in javascript. Using javascript methods. Also do not want to use slice. Please guide me on this.
I have tried this
const array = [1, 2, 3, 5]
function filterItems(array, index) { return array[index]; } console.log(filterItems(array, 0));
this will output 1. but how to do using javascript methods and without using slice