JavaScript Interview Questions and Answers
Test your skills through the online practice test: JavaScript Quiz Online Practice Test
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:
- What are JavaScript data types?
- What's relationship between JavaScript and ECMAScript?
- What does isNaN function do?
- How do you convert numbers between different bases in JavaScript?
- What is negative infinity?