everyone. I am trying to write a function that takes an item, looks through a current shopping cart(an object), checks if the item is in the cart, deletes it if true, and return "That item is not in your cart." if false. I have this so far.
var cart = {}
function removeFromCart(item){
var cartItems = Object.keys(cart)
for (var i=0; i<cartItems.length ; i++){
if (cartItems[i]===item){
delete cart.item
return
}
else if (i === cartItems.length) {
console.log("That item is not in your cart.")
}
}
}