Code Lab

Modo entrevista. Temporizador de 3 min, sin pistas y sin autocompletado

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.

Preguntada en Mastercard · Fuente

Tu respuesta
Cargando el editor…
Ejecuta tu código para ver aquí los resultados de las pruebas