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