Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get value of object by index js

var obj = {
    dog: "woof",
    cat: "meow",
    key: function(n) {
        return this[Object.keys(this)[n]];
    }
};
obj.key(1); // "meow"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #object #index #js
ADD COMMENT
Topic
Name
1+5 =