1

I’m having an issue with this line –

obj.results[0][2017].admissions.sat_scores.25th_percentile.math

It’s giving me a syntax error. I’m using Javascript and it seems to be having a problem with the number 25. This code works just fine –

obj.results[0][2017].admissions.sat_scores.average.overall

Any line that reads admissions.sat_scores.[NUMBER] throws an error. What I'm I doing wrong?

1 Answer 1

2

The problem was with the way I tried to access that property. Since the key name starts with a number, I need to use brackets. This expression works.

obj.results[0][2017].admissions.sat_scores["25th_percentile"].math;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.