I cannot understand the following code, var formData = {};
I guess defines a object "formData", but why to save each element in the formdata["fullName"]
? What is this with []? Isn't it used for array? i confused. Could somebody explain this code? Thank you!
function readFormData(){
var formData = {};
formdata["fullName"] = document.getElementById("fullName").value;
formdata["empID"] = document.getElementById("empID").value;
formdata["salary"] = document.getElementById("salary").value;
formdata["city"] = document.getElementById("city").value;
return formData;
}