Code Lab

Mode entretien. Minuteur de 3 min, sans indices ni autocomplétion

String plus number

FacileBasics3 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.

Posé chez Mastercard · Source

Votre réponse
Chargement de l'éditeur...
Exécutez votre code pour voir ici les résultats des tests