Push to a javascript array if it exists, if not then create it first -


Is there always a way for this line to work and do not throw a typed error: 'whatever' Can not read

var MyArray = []; MyArray [StringVariableName] [StringVariableName2] .push ("Anything");

Try it out:

  var MyArray = [ ]; Mayré [StringveriNname] = MyEre [StringveriName] || []; Mayré [StringveriName] [StringveriName 2] = Marrea [StringveriName] [StringveriName 2] || []; MyArray [StringVariableName] [StringVariableName2] .push ("Anything");  

Comments