Pular para o conteúdo principal

Questão de TI - Desenvolvimento de Sistemas — Javascript — FGV 2021

TI - Desenvolvimento de SistemasJavascript
Código
fg150127
Banca
FGV
Órgão
BANESTES
Ano
2021
Cargo
Ana TI ( )
Analise o script JS a seguir.   <script> function xpto() {      let n = 0;      return {next:                function()                {                   if (n < 10) {                      n += 2;                      return {value:n/2, done:false}}                   else {                     return {value: -1, done: true}}                }   } } saida = "" const n = xpto(); x = n.next(); while (x.done == false) {    saida += x.value + "/";    x = n.next(); } alert(saida); </script>   O resultado da execução desse código é:
  1. A-1/-2/-3/-4/-5/
  2. B0/1/2/3/4/5/
  3. C1/2/3/4/5/
  4. D5/4/3/2/1/
  5. E5/4/3/2/1/0
Revelar gabarito e comentário

GabaritoC — 1/2/3/4/5/

Link permanente: /questoes/fg150127