Modo entrevista. Cronômetro de 3 min, sem dicas e sem autocompletar
Yes or no
FácilFunctions3 min
Write a function ask(agree, yes, no). yes and no are functions too, they are callbacks.
If agree is true, call yes, otherwise call no. Return what the called function returned.
Exemplos
ask(true, () => 'ok', () => 'cancel')Retorna 'ok'
ask(false, () => 'ok', () => 'cancel')Retorna 'cancel'
Carregando o editor...
- With true returns the result of yes
- With false returns the result of no
Os testes ocultos rodam no envio