What is wrong with this switch / else statment? Trying to create language greeting based on country and time [duplicate]
This question already has answers here: Expression for “is x greater than y and less than z”? (3 answers) Closed last month. So I am trying to write code that uses the time and country to determine the correct greeting…..what is wrong with this code? If the country is Spain or Mexico and the time […]
How to properly format a switch statement
Problem: It is morning if the time is 0 or more, but less than 12. If the time is 12 or more, but less than 24, it is evening. If time is any other value, greeting should always be null, whatever the language.
How does the switch statement work without the break [duplicate]
This question already has answers here: JavaScript: Understanding cases in switch (2 answers) Closed 1 hour ago. I’m using the switch statement without the breaks and it seems it defaults to the last case even if it does not meet the condition. function getLetter(s) { let letter; // Write your code here console.log(s[0]) switch (s[0]){ […]