I have the following JSON.
let carStr = `{
"_id": "Tesla-200",
"Design": {
"Wheel": "Black",
"Seat": "4",
"Speed": "200"
}
}`;
let car = JSON.parse(carStr);
let key = "Design.Wheel";
let keys = key.split(".");
let value = car[keys[0]][keys[1]]; // Need to get this value dynamically rather than hard-coding
console.log(value);
The key is input from another section. How do get the value "Black" by passing the key "Design.Wheel" as text dynamically.