JavaScript Tricky Interview Questions And Answers

Posted by

JavaScript Tricky Interview Questions And Answers are asked for Angular, Typescript, Node js, and React js interviews. The interviewer checks the basic knowledge of JavaScript.

How to initialize an array in JavaScript

We have two ways to initialize an array in JavaScript. First, we can use a square bracket [] . or we can use new Array keyword.

How to find the number of characters of the string in JavaScript?

We use str.length to find the character length of the string.

Which function of an array object removes the first element from an array and returns that removed element?

We use shift() function to remove the first element and this function also returns that removed element.

What is the syntax of removing the white space at the beginning and end of any string?

We use trim function to remove the white space from the beginning and from the end of the string.

Predict the output on the console for the following code:

Question 1: What will be the out of the following filter code:

Check the filter JavaScript Array method.

Question 2: Predict the output:

Question 3: What typeof return in the below code?

We will get object in the console because the function returns an object.

Question 4: What will be the output of the below console code:

It will return true in the console.

Question 5: Predict the answer:

It will show 55 in the console because 5 and "5" will be concatenated.

Question 6: What will be the output of the below console code?

It will show R,R,T in the console.

Question 7: Predict the output:

It will return string because the variable is storing the string value.

Question 8: Predict the answer:

The output will show 0 in the console.

Question 9: Predict the length of the array.

The output will be 2 .

Question 10: What typeof return in the below code?

It will show number in the console because we are assigning the number in the variable(a) and returning that variable in the function.

Question 11: Predict the output of the below console log:

Both console logs return false results because of comparing two different arrays or objects.

Question 12: Guess the output of the below JavaScript code:

The output will be “Hi”.

Question 13: What will be the output of the below JavaScript code:

Output: 40

Conclusion:

These are the JavaScript Tricky Interview Questions And Answers. Read those questions and answers before attending an interview related to JavaScript, Angular, Node, and React.

Leave a Reply

Your email address will not be published. Required fields are marked *