I am trying to get keys from users using javascript and storing it in a javascript object. i.e when i press \'A\', 1 should be added to myJSON[65]. The following cod
Try this:
var keyStopper=false; window.onkeydown=function(e){ if(keyStopper)return e.keyCode; keyStopper=true; console.log(myJSON); myJSON[parseInt(e.keyCode)].push(1); } window.onkeyup = function(e){ keyStopper=false; }