Javascript examples for Object:Reflection
Turn string into object attribute
<html> <head></head> <body> <script> var human = {/*www . ja v a2s. co m*/ name: "Smith", age: "29" }; var manAttributes = ["age","name"]; for(var prop in manAttributes){ if(human.hasOwnProperty(manAttributes[prop])){ console.log(manAttributes[prop] + ": "+human[manAttributes[prop]]); } } </script> </body> </html>