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

11 Tips That Make You a Better Typescript Programmer

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!