I've declared a simple JavaScript object which is the model model of a table.
The code works fine and I can access all the data that i need.
For some reason, if i get Uncaught SyntaxError: Invalid or unexpected token
when i write the highlighted attribute (in the next piece of code) with numbers followed by letters:
var parameters_table = {
M:{D:3.944,T:1.1606,M:5.3893},
7:{D:5.1847,T:2.059,M:2.8712},
aug:{D:4.99,T:6.173,M:1.495},
6:{D:4.962,T:1.2287,M:0.94456},
aug7:{D:6.14,T:4.16,M:0.632},
m7b5:{D:6.12226,T:2.6665,M:0.29159},
7sus4:{D:4.7313,T:2.7964,M:0.2592}//Here there's the error with the name
};
if i write something like:
var parameters_table = {
M:{D:3.944,T:1.1606,M:5.3893},
7:{D:5.1847,T:2.059,M:2.8712},
aug:{D:4.99,T:6.173,M:1.495},
6:{D:4.962,T:1.2287,M:0.94456},
aug7:{D:6.14,T:4.16,M:0.632},
m7b5:{D:6.12226,T:2.6665,M:0.29159},
sus4:{D:4.7313,T:2.7964,M:0.2592}//This works
};
Just by removing the 7
, it works fine.
Why do i get this error? I thought it could be a problem with alphanumeric names, but i've already used mixed characters (numbers + letters) in the other fields without any problems.