Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.age = 8
- this.name = "Steve"
- manAttributes = ["age","name"]
- console.log(Human.manAttributes[0])
- var human = {
- 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]]);
- }
- }
- var Human = {
- manAttributes: ["age","name"],
- age: 8
- };
- alert(Human[Human.manAttributes[0]]); //alerts 8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement