So I am currently doing an Assignment where I have to make a code that when someone opens the page, they input the weight of an egg and it comes back with what "size" it is.
I got the code working and I sent it to my teacher for feedback. However, she came back with telling me I should make the code more "Elegant and Efficient". But she did not instruct me how to do so. Any help on this topic will be greatly appreciated. Code is below
<script>
var eggWeight = prompt("Please enter an egg weight in grams: ");
parseInt(eggWeight);
while (isNaN(eggWeight)) {
eggWeight = prompt("This is not a valid number. Please an enter egg weight in grams: ");
parseInt(eggWeight);
}
if (eggWeight > 69)
alert('Jumbo');
else if (eggWeight > 63 && eggWeight <= 69)
alert('Extra Large');
else if (eggWeight > 55 && eggWeight <= 63)
alert('Large');
else if (eggWeight > 48 && eggWeight <= 55)
alert('Medium');
else if (eggWeight > 42 && eggWeight <= 48)
alert('Small');
else
alert('Peewee');
</script>