Your code works well.
All you have to do is one of two things:
Add a trimmer () to the line where you get the element (it will remove all spaces before and after the line you enter in the input, it is good practice to do this always):
var item = document.getElementById("itemName").value.trim();
Or remove the space from the input value of the element:
<input type="text" id="itemName" value="">
The problem is that you get the Item value with a space at the beginning of the egg, so the switch ignores your input because there is no case that matches this.
Also, as a recommendation, do not use the form for each input. The form tag should surround all inputs with labels that are necessary in your operation.
source share