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?

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;

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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