I'm trying to construct a multidimensional array in javascript, so far without success. I've read some other posts here on Stackoverflow, and read/watched tutorials on the subject, all have helped me but but I can't get it to work.
Most of the time I get the following error:
Uncaught SyntaxError: Unexpected token
Basically, I've got a form where the visitor of my website can input their age, bloodpressure, cholesterol and if they're a smoker of not.
riscTable = {
'68': { // AGE
'170': { // BLOODPRESSURE
// M, MS, W, WS
'275': { 27, 48, 16, 30 }, // CHOLESTEROL
'225': { 22, 41, 13, 24 }, // CHOLESTEROL
'175': { 18, 34, 10, 20 }, // CHOLESTEROL
'0': { 15, 28, 8, 16 } // ...
},
'150': {
'275': { 20, 36, 11, 22 },
'225': { 16, 30, 9, 18 },
'175': { 13, 25, 7, 14 },
'0': { 10, 20, 6, 12 }
},
'130': {
'275': { 14, 27, 8, 15 },
'225': { 11, 22, 6, 13 },
'175': { 9, 18, 5, 10 },
'0': { 7, 15, 4, 8 }
},
'0': {
'275': { 10, 19, 5, 11 },
'225': { 8, 16, 4, 9 },
'175': { 6, 13, 3, 7 },
'0': { 5, 10, 3, 6 }
}
},
'63': ... // AGE
}
I've added comment tags to make my array structure more understandable.
What I was thinking on doing was to run over the key-value's with mathmatical logic (putting the heightest value always on top) to determine the result.
Example for the code above:
A non-smoking woman, age 65 (heigher as 63 so she falls under the 68 array), bloodpressure 150 and a cholesterol of 175 should return the value: 7
What am I doing wrong to get "Uncaught SyntaxError: Unexpected token" error, and how can I let my script run over the arrays to return the correct result, as shown in the example above?
Thank you for reading my question, I hope somebody can help me.