Загрузка...

What is the output 🤔👇..#codingshorts #javascript #tech

Did you get the correct output? 😳

Let’s break this down step by step:

👉 In JavaScript, when you add a number and a string together, the number is automatically converted into a string. This is called type coercion.

Now look carefully:

1 + "2" → becomes "12"
Because the number 1 is converted into a string.

Then:
"12" + 3 → becomes "123"

👉 Again, 3 is converted into a string and concatenated.

💡 Final Output: "123"

👉 This is a very common concept in JavaScript interviews.
👉 Many beginners get confused here because they expect mathematical addition.

📌 Key takeaway:
JavaScript follows string concatenation when a string is involved.

📌 Save this for interview prep
👇 Comment your answer before reading
#coding #javascript #learncoding #developers #programming #codingchallenge #webdev #tech

🎯

javascript output questions, type coercion js, coding interview prep

Видео What is the output 🤔👇..#codingshorts #javascript #tech канала ScaleIn60sec
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять