We can add or remove values from an array using splice() function.
the splice() function returns the removed element(s).
syntex: arrayName.splice(Startindex,HowManyElements,element1,.....,elementX)
eg.
< script type="text/javascript" >
var employes = ["Rolen", "Pankaj", "JS", "Bhupendra"];
document.write("Removed: " + employes.splice(2,1,"Pankaj") + "< br / >");
document.write(employes);
< /script >
Solution By: Rajesh Rolen
No comments:
Post a Comment