+ 1
What's wrong with this code?
6 Respostas
+ 5
// Use "if", "else if" and "else" statement than "switch".
+ 3
// Correction:
var x = new Date().getHours();
- You have not use a "new" keyword to declare this object.
- You have forgotten to use "()" for getHours() because it is a function, otherwise, it is considered as a variable.
+ 3
// I've solved your code:
https://code.sololearn.com/WE6VQ8A3yIs2/?ref=app
+ 2
Thanks. Let me check
+ 1
It's still not working. Pls help
+ 1
switch case works for matching case, to understand this in a better way, I have done the correction work with switch case
take a look...
https://code.sololearn.com/WpumIZjI1uos/?ref=app