Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let numberOfItems = 0;
- let itemIndex = 0;
- let itemNum = 0;
- let counter = 0;
- while (numberOfItems < 10) {
- numberOfItems = prompt("Enter the number of items in the auction (must be >= 10)")
- }
- const itemCode = [];
- const itemDescription = [];
- const itemReservePrice = [];
- const itemHighestBid = [];
- const itemNumberOfBids = [];
- const itemSoldStatus = [];
- const itemBuyerCode = [];
- for (itemIndex = 1; itemIndex <= numberOfItems; itemIndex++) {
- counter = 1;
- if (itemIndex === 1) {
- itemNum = prompt("Enter the unique item number: ");
- }
- while (counter < itemIndex) {
- if (counter === 1) {
- itemNum = prompt("Enter the unique item number: ");
- }
- if (itemNum === itemCode[counter]) {
- alert(`The item number: ${itemNum} already exists!`);
- counter = 0;
- }
- counter++;
- }
- itemCode[itemIndex] = itemNum;
- itemDescription[itemIndex] = prompt("Enter the item description.");
- itemReservePrice[itemIndex] = prompt("Enter the item reserve price: ");
- itemHighestBid[itemIndex] = 0;
- itemNumberOfBids[itemIndex] = 0;
- itemSoldStatus[itemIndex] = false;
- itemBuyerCode[itemIndex] = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement