Is it possible to creat an object literal on the fly? Like this:
var arr = [ 'one', 'two', 'three' ]; 
var literal = {}; 
for(var i=0;i<arr.length;i++)
{
   // some literal push method here! 
  /*  literal = {
        one : "", 
        two : "",
        three : ""
    }  */ 
}
Thus I want the result to be like this:
 literal = {
        one : "", 
        two : "",
        three : ""
    } 
                for ( var i = 0, l = arr.length; i < l; ++i ) {
    literal[arr[i]] = "something";
}
I also took the liberty of optimising your loop :)
Use this in your loop:
literal[arr[i]] = "";
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With