-4
I have a problem in an exercise of an online course that I am doing, I have tried in every way I could reach but it does not accept. I don’t know where I’m going wrong. Exercise is down, along with my code.
Enunciation:
Now let’s create a function that tells us if the bank is closed?
First of all we need to know that a bank is closed when it is weekend (Saturday or Sunday) and is not in bank hours (9 to 15hs).
Set the function possibleIrAoBanco which, receive two parameters, the first is diaDaSemana (string) and the second timeAtual(number), the function must return true, only if the database is open.
Example:
possoIrAoBanco("segunda-feira", 10); // true, é um dia da semana e está no horário bancário, 10hs possoIrAoBanco("terça-feira", 18); // false, é dia da semana e NÃO está no horário bancário, 18hs possoIrAoBanco("Sábado", 11); // false, é fim de semana
Remember that you can do what is necessary using the
return
without making use ofif
/else
.
Error that appear are this :
The execution of the function
possoIrAoBanco('Segunda', 10)
must returntrue
The execution of the functionpossoIrAoBanco('Terça', 18)
must returnfalse
The execution of the functionpossoIrAoBanco('Sábado', 11)
must returnfalse
The execution of the functionpossoIrAoBanco('Domingo',13)
must returnfalse
My code is like this:
This answers your question? Function that returns if one can go to the database with true/false?
– Rafael Tavares