- startIndex – Index of an object in the array.
- deleteCount – Number of items to be removed. (If this isn’t supplied, it removes all the object from the mentioned index).
let fruits = ["Apple", "Lychee","Mango","Orange","Pear","Pineapple"]; let fruits1 = [...fruits]; fruits.splice(2); document.write("Array contains: ", fruits); document.write("<br/><br/>"); fruits1.splice(2,1); document.write("Array contains: ", fruits1);
The pop() function removes the last object from an array.
let gadgets = ["Mobile","Earphones", "TWS", "Ultrabooks", "Powerbanks"]; let removedGadgets = gadgets.pop(); document.write("Array contains : ", gadgets); document.write("Removed object : ", removedGadgets);
let apps = ["TikTok","VS Code", "Notepad++", "XCode", "Snippy Tool", "Figma"]; let removedApp = apps.shift(); document.write("Useful Apps : ", apps); document.write("<br/><br/>"); document.write("Removed Apps : ", removedApp);
Create a simple Login form using only HTML and CSS