I have a json object I am querying in jquery and having trouble using the values stored in jquery variables. Example:
$tops= json.tops
$color = "blue";
If I console.log($tops.blue); I get the expected result. But, if I console.log($tops.$color); I get 'undefined'.
Can anyone explain what I am doing wrong/what the difference is?
jsonever parsed? What gets returned when you type intypeof json?$tops.blueto be the same as$tops.$color? You haven't assigned$tops.$color.$color = 'blue'(with quotes), and$tops[$color].