I don't know if this is the right title for this question but this is my example:
var myvar = [];
var othervar = [];
var somevar = [];
function testing(type) {
window[type].push('some value');
console.log(type);
}
<button onclick="testing('myvar')">press here</button>
<button onclick="testing('othervar')">press here</button>
<button onclick="testing('somevar')">press here</button>
this function should push some value to the global variable indicated as its argument but nothing happens. I also tried type.push('some value');
but it didn't work either. What is the right syntax?