Answers for "select the first 2 items in an array javascript"

2

javascript select first n elements from array

const array = ['toto','tata','titi','tutu'];

array.slice(0, 2); // => ['toto','tata']
Posted by: Guest on March-08-2021

Code answers related to "select the first 2 items in an array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language