Create 3 different cellPhones objects: cell1, cell2 and cell3
Every object has this attributes: brand, model, colour, price, isAvailable
Create a user menu to give the possibility of changing the prices or availability of each cellPhone.
Check those changes through the console showing the object.
let cell1 = {
price: "",
colour: "",
brand: "",
model: ""
};
let cell2 = {
price: "",
colour: "",
brand: "",
model: ""
};
let cell3 = {
price: "",
colour: "",
brand: "",
model: ""
};
let cellString = 'price: ' + cell.price + ' colour: ' + cell.price + ' brand: ' + cell.brand + 'model: ' + cell.model;
for (let i = 1; i < 5; i++) {
let option = parseInt(prompt('how would you like your cellphone 1-Change price 2-Change colour 3-Change brand 4-Change model'));
switch (option) {
case 1:
letnewprice = parseInt(prompt('Type in the new price '));
cell.price = newprice;
alert('price is updated');
break;
case 2:
letnewcolour = prompt('Type in the new colour')
cell.colour = new colour;
alert('colour is updated')
break;
case 3:
letnewbrand = prompt('Type in the new brand');
cell.brand = newbrand;
alert('brand is updated');
break;
case 4:
letnewmodel = prompt('Type in the new model');
cell.model = newmodel;
alert('model is updated');
break;
default:
alert('this is not an option');
break;
}
console.log(cell1);
}