Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

JavaScript Interview Questions and Answers

Ques 6. How do you create a new object in JavaScript?

Ways to create a new object in javascript:
  • var obj = new Object(); 
  • var obj = {};

Is it helpful? Add Comment View Comments
 

Ques 7. How about 2+5+"8"?

Since 2 and 5 are integers, this is number arithmetic, since 8 is a string, it's concatenation, so 78 is the result.

Is it helpful? Add Comment View Comments
 

Ques 8. What does "1"+2+4 evaluate to?

Since 1 is a string, everything is a string, so the result is 124.

Is it helpful? Add Comment View Comments
 

Ques 9. How do you assign object properties?

Ways to assign object properties:
  • obj["age"] = 18
  • obj.age = 18

Is it helpful? Add Comment View Comments
 

Ques 10. What's a way to append a value to an array?

arr[arr.length] = value;

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2021 WithoutBook