Code Lab

Modo entrevista. Cronômetro de 3 min, sem dicas e sem autocompletar

String plus number

FácilBasics3 min

What does this program print? Write the output: one line for each console log call, in the same order.

const s = 21 + 'abc' + 49 + 14;
console.log(s);

const t = 21 + 49 + 'abc' + 14;
console.log(t);
  • The program mixes numbers and strings with +. Think about when + adds numbers and when it joins text (concatenation), and when JavaScript turns a number into a string by itself (type coercion).
  • Type each line exactly as the console shows it: a string is printed without quotes.

Cobrada em Mastercard · Fonte

Sua resposta
Carregando o editor...
Execute seu código para ver o resultado dos testes aqui