dimanche 1 mars 2015

Javascript Can Someone please Explain this code snippet(Newbie) [on hold]




var someObj = {propName: 17};
var myProperty = "propName";
someObj[myProperty];

console.log(someObj[myProperty]);



If someone could explain how propName is within quotes ie a string,yet javascript uses the property someOjb.propname


How does it know to use someObj?what if their were more objects with that property? How does the javacript actually work for this


If someone could explain how or why this works I really would appreciate it


sincerely thanks


Aucun commentaire:

Enregistrer un commentaire