In the code snippet provided, an element is taken from the DOM and stored in a variable called myEl. The second variable, myObj, is an empty object initially. The purpose of this code is to create a new object with attributes based on the properties of the element passed in.
function getAttributes(myEl, myObj){
attArray = [
"tagName",
"id",
"name"
];
for (var att in attArray){
if (myEl.hasOwnProperty(attArray[att])) {
myObj.attributes = {};
myObj.attributes.hasOwnProperty(attArray[att]) == myEl.hasOwnProperty(attArray[att]);
};
};
};