Modify Object Literal Properties In JavaScript
This Article is a continue of the previous Blog here
In this Article i will show you how to create a function to change the Object Literal Properties In JavaScript
In this Javascript Sample Code i will Create 2 function
- modiObj(modiName) -> This will loop through the array to find the Object that the User want to Change, then it will call the change(obj,ser) , where it will change the existing Serial Number with the new inputted Serial Number.
- change(obj,ser) -> Change the Object Literal Properties ” Serial Number ” from the existing Serial Number to new Serial Number.
How to Use
- Enter the Clone Properties and Create a few Clone Object
- Key in the Clone Name where you want to modify the Serial Number
- Key in the New Serial Number and Click ” Modify “
Start Cloning
Clone Name :
Serial Number :
Gender :
Terminate :
Modify Serial Number
Name To Modify
New Serial
CODE Snipplet
function change(obj,ser) { obj.serialNumber = ser; } function modiObj(modiName){ removearray = document.getElementById("modiName").value; var arraylength = allBots.length; // search for the Bot Name for(var i=0; i<arraylength;i++) { if (removearray == allBots[i].name){ // If you get the Bot Name , replace the Serial Number // Get the Object Name funName = clbot[i]; val1 = document.getElementById("newSerial").value; change(clbot[i],val1); break; } } }