This is a pretty simple question, but I can't figure out what I'm doing wrong. Say I have this object:
features: {
savings: {
link: "test.html",
img: "/_assets/img/related-content/sample.png"
},
security: {
link: "test2.html",
img: "/_assets/img/related-content/sample2.png"
},
speed: {
link: "test3.html",
img: "/_assets/img/related-content/sample3.png"
}
}
Assume that this format is set and cannot be changed. I can easily select by doing something like features["savings"].link
. But let's say I want to get a random item from this object. I would generate a random number, and then select the index using that. But features[randnum].link
doesn't work. Why is this? How can I do this without modifying the object format?
Thanks!