1) .slice() method
// .slice() method
// 0 1 2 3 4
const a = ['a', 'b', 'c', '10', 'd'];
const b = a.slice(2, 4)
console.log(a);
console.log(b); // this will contain the removed elements i.e, 'c' & '10'
==========================================================================================
TERMINAL:
Comments
Post a Comment