Javascript Object
Go to solution
Solved by vorticalbox,
Your bestidever in objecttwo is an array so you need to put the index you wish to access.
var objectone = {
"id":"bestidever"
}
var objecttwo = {
"bestidever":[{"myValue":"print me!"}]
}
var item = objecttwo[objectone.id]
console.log(item[0].myValue) //displays print me!
or if you want it in one line
console.log(objecttwo[objectone.id][0].myValue)
I'm not exactly sure what you're planning to use this for but hope this helped

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now