CODE PROVIDED

%%js

var alphabet = "abcdefghijklmnopqrstuvwxyz";
var alphabetList = [];

for (var i = 0; i < 10; i++) {
	alphabetList.push(i);
}

console.log(alphabetList);
<IPython.core.display.Javascript object>

WHAT I CHANGED

%%js

var alphabet = "abcdefghijklmnopqrstuvwxyz";
var alphabetList = [];

for (var i = 0; i < 26; i++) {
    alphabetList.push(alphabet[i]);
}

console.log(alphabetList);

<IPython.core.display.Javascript object>

WHAT WAS PROVIDED

%%js

// Copy your previous code to built alphabetList here

let letterNumber = 5

for (var i = 0; i < alphabetList; i++) {
	if (i === letterNumber) {
		console.log(letterNumber + " is letter number 1 in the alphabet")
	}
}
<IPython.core.display.Javascript object>

WHAT I CHANGED

%%js

var alphabet = "abcdefghijklmnopqrstuvwxyz";
var alphabetList = [];

for (var i = 0; i < 26; i++) {
    alphabetList.push(alphabet[i]);
}

console.log(alphabetList);

let letterNumber = 1

for (var i = 0; i < alphabetList.length; i++) {
	if (i === letterNumber - 1 ) {
		console.log(alphabetList[i] + " is letter number"+ letterNumber + "in the alphabet")
	}
}
<IPython.core.display.Javascript object>

WHAT WAS GIVEN

%%js

var numbers = []
var newNumbers = []
var i = 0

while (i < 100) {
    numbers.push(i)
    i += 1
}
for (var i of numbers) {
    if (numbers[i] % 5 === 0)
        newNumbers.push(numbers[i])
    if (numbers[i] % 2 === 0)
        newNumbers.push(numbers[i])
}
console.log(newNumbers) 
<IPython.core.display.Javascript object>

WHAT I DID:

using the two straight lines, I was able to not only print out each multiple of 2 and 5 once, but was also able to get the multiples of both 2 and 5. The prioblem with the previous code is it didn’t account for duplicates.

%%js

var numbers = []
var newNumbers = []
var i = 0

while (i < 100) {
    numbers.push(i)
    i += 1
}
for (var i = 0; i<numbers.length; i++) {
    if (numbers[i] % 2 === 0 || numbers[i] % 5 === 0){
        newNumbers.push(numbers[i]); 
}

console.log(newNumbers) 
<IPython.core.display.Javascript object>

WHAT WAS GIVEN

%%js

var menu =  {"burger": 3.99,
         "fries": 1.99,
         "drink": 0.99}
var total = 0

//shows the user the menu and prompts them to select an item
console.log("Menu")
for (var item in menu) {
    console.log(item + "  $" + menu[item].toFixed(2)) //why is toFixed used?
}
//ideally the code should support mutliple items
var item = "burger"

//code should add the price of the menu items selected by the user 
console.log(total)
<IPython.core.display.Javascript object>

WHAT I DID

%%js
var menu =  {"burger": 3.99,
         "fries": 1.99,
         "drink": 0.99}
var total = 0

//shows the user the menu and prompts them to select an item
console.log("Menu")
var item = prompt("Can you input what item you want please")

//uses a for loop to get the price for each item and add it to the total. 
for (var item.toLowerCase in menu) {
    //this code should get the number which is stored in the food name
    var price= menu[item];
    //add it to the total
    total +=price;
    console.log("your total is" + total.toFixed(2));
}



//code should add the price of the menu items selected by the user and output the total
console.log("Final total is" + total)
<IPython.core.display.Javascript object>

How ever, there is an error in the code I provided. it would be wrong to have item.toLowerCase in the for loop

%%js

var menu = {
    "burger": 3.99,
    "fries": 1.99,
    "drink": 0.99
};

var total = 0;

// Show the user the menu and prompt them to select an item
console.log("Menu");
var item = prompt("Can you input what item you want please");

//Convert the user's input to lowercase for case-insensitive comparison
item = item.toLowerCase();

// Use a different variable (menuItem) for the loop
for (var menuItem in menu) {
    if (menuItem == item) {
        // Get the price for the selected item
        var price = menu[menuItem];
        total += price;
        console.log("Added " + menuItem + " to your order. Your total is $" + total.toFixed(2));
        break; // Exit the loop once the item is found
    }
}

// Check if the item was not found in the menu
if (total === 0) {
    console.log("Item not found in the menu");
}

// Display the final total
console.log("Final total is $" + total.toFixed(2));

<IPython.core.display.Javascript object>