Trying to finish up an assignment and I can't seem to find get around this: Here's what is being asked:
"Your JavaScript program should parse the user’s inputs. For each input, you should create a JavaScript object of Shopper to hold the data parsed from user’s input. Make sure that each object should have a property named “Items” which should have an string array of items as value, e.g. [“Milk”, “Shoes”, “Phone”]."
Here is what I've done so far:
var shopper = {
first_name : "",
last_name : "",
email : "",
items: []
};
var flag = true;
var x = 0;
while (flag == true) {
var temp_obj = prompt("Please enter your first name, last name, email and items separated by ,");
if (temp_obj == "" || temp_obj == null) {
flag = false;
}
/*Here I'm suppose to create instances of the object..Have no idea how. this is what I think might work.
var shopper[x] = Object.create(shopper);
x++
*/
}