So I have an object that looks like:
var computer={
"Home":{
"Applications":{
"Desktop":{
},
"Documents":{
},
"Downloads":{
},
"Library":{
},
"Movies":{
},
"Music":{
},
"Pictures":{
}
}
},
"Library":{
},
"Downloads":{
},
"Files":{
},
"Devices":{
"USB":{
},
"Hard_Drive":{
}
}
}
I also have an input box that should receive the input from the user to location
. Then looking up that location using console.log(computer[location]);
should show all of the children of that object. So the basic idea is this:
var location = document.getElementById("inputId");
console.log(computer[location]);
What are some patterns I can use to make this work? I'm also open to changing the idea of having computer as a object or any other changes. I just need to make this work. Thanks in advance.