i want to build an object using this code
$("input").bind("keydown",function(e){
var code = (e.keyCode ? e.keyCode : e.which);
if (code == 13){
var guess = $("input").val();
guess = guess.split(" ");
var oGuess = {};
for (var x = 0; guess.length ; x++){
oGuess[x] = oGuess[x] = {"text": guess[x]};
}
$("input").val("");
}
});
this actually crashes my browsers(latest stable ff and chrome) upon hitting enter. heres the jsfiddle http://jsfiddle.net/kfqJC/1/
i need the object to be something like this
oGuess = {
"1": { "text" : string}
"2": { "text" : string}
...
}
what am I missing here?