0

How can I dynamically set theName and change it? Is there a way to do that?

var myTeam = new Object ();

 function AddObject(theName) {

   var person = new Object();
   person.firstName = "John";
   person.lastName = "Doe";
   person.age = 50;
   person.eyeColor = "blue";

  myTeam.theName =  person;
}

AddObject("Example1");
AddObject("Example2");
AddObject("Example3");
Jesse Kernaghan
  • 4,544
  • 2
  • 18
  • 25
Martin Andersen
  • 173
  • 1
  • 8

0 Answers0