I have defined a variables outside of a function and I need to be able to call the variable depending on the parameter that is called with the function.
HTML
<button id="Area300" style="left:755px;" onclick="a('normal', 'Area300')"></button>
JAVASCRIPT
var Area300_Data = "somedata"
function a(data, data1) {
if (data=='extra') {
//do something
} else if (data=='normal') {
console.log(data1+_Data)
//Should display "somedata"
}
}
How do I combine the parameter of data1 to _Data to get (in this case) Area300_Data?
objectkeyvaluepair