I have this variable that is stored in a string
var employee = {
name: 'person',
job: {
post: 'developer',
since: 2010,
desk: {
number: '1',
}
}
};
How can i get the keychain value from a string e.g.
var variable = "job.desk.number";
console.log(variable);
//this should return 1
UPDATE 3 !!
@T.J. Crowder's answer is actually the best answer.
His function is quick and tidy. :) horry!