StoryFebruary 17, 20241 min read

Javascript Interview Questions (Question- 1)

Theres are lot of interview questions in javascript, we will cover one by one in future stories,


Javascript Interview Questions (for beginners)

Photo by LinkedIn Sales Solutions on Unsplash

Hello Everyone!

If you are non-member, read here

Theres are lot of interview questions in javascript, we will cover one by one in future stories,

Will learn it and understand the concept of the questions.

Let’s get started

Question 1:

What will be the output of below code

const number = 10 + “10” - 10
console.log(number)

Try it by yourself and comeback to understand the answer

Answer:

As we know DMSA lineup

It will always start with addition in above scenario

10 + “10”

Remember, two operands addition ➕ will always convert its types to strings if any one of the operand is string

Basically, its concatenate

So 10 + “10” will be “1010”

Now left statement is “1010” – 10

If one operand is number and another is string in the subtraction, the output only comes in number

Here, “1010” will first convert into 1010

And the 1010 – 10

An output will 1000

Follow me for more interview questions like this,

We will try to cover everything related to javascript topics and try to understand it together 😊

Till then, keep learning…