DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Lakshya Tyagi
Lakshya Tyagi

Posted on

What will the code below output to the console and why?

Write your answer in comment

  1. console.log(1 + +"3" + "3");
  2. console.log(1 +"3" + "3");
  3. console.log(1 + -"1" + "3");
  4. console.log(+"1" + "1" + "3");
  5. console.log("X" - "Y" + "3");
  6. console.log("X" - "Y" + 3);

Top comments (7)

Collapse
 
lakshyatyagi24 profile image
Lakshya Tyagi

javaScript

Collapse
 
metalmikester profile image
Michel Renaud

There's a Python tag in the question (at first I thought it was JavaScript).

Collapse
 
lakshyatyagi24 profile image
Lakshya Tyagi

yeh sorry by mistake i put wrong tag

 
metalmikester profile image
Michel Renaud

I've been meaning to learn Python for years but... Ooooh! Netflix! LOL

Classic DEV Post from 2020:

js visualized

πŸš€βš™οΈ JavaScript Visualized: the JavaScript Engine

As JavaScript devs, we usually don't have to deal with compilers ourselves. However, it's definitely good to know the basics of the JavaScript engine and see how it handles our human-friendly JS code, and turns it into something machines understand! πŸ₯³

Happy coding!