D
D
dhat2016-08-06 20:41:11
JSON
dhat, 2016-08-06 20:41:11

Why doesn't JS read the rest of the JSON values?

var info = {
   "Team": "Antalyaspor",
   "OverallOver": "26",
   "OverallUnder": "8",
   "OverallOver%": "76",
   "OverallUnder%": "24",
   "HomeOver": "14",
   "HomeUnder": "3",
   "HomeOver%": "82",
   "HomeUnder%": "18",
   "AwayOver": "12",
   "AwayUnder": "5",
   "AwayOver%": "71",
   "AwayUnder%": "29"
 };
 
alert(info.OverallOver%);

alert works only with the first Team key, the others are not called. Why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2016-08-06
@dhat

% is not a valid symbol for names, so you need to write it like this:info['OverallOver%']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question