Professional Documents
Culture Documents
Latest JavaScript Interview Questions and Answers PDF - CodeProject
Latest JavaScript Interview Questions and Answers PDF - CodeProject
Latest JavaScript Interview Questions and Answers PDF - CodeProject
LatestJavaScriptInterviewQuestionsandAnswersPDFCodeProject
12,062,666
members
47,291
online
Sign up for
our free
weekly
Web Developer Newsletter.
articles
Q&A
forums
Sign in
Searchforarticles,questions,tips
lounge
CPOL
Rate this:
4.66 65 votes
JavaScript Interview Questions Answers
Introduction
Below is the list of latest and updated JavaScript interview questions and their answers for freshers as well as experienced
users. These interview questions will help you to prepare for the interviews, So let's start....
Code
Hide Copy Code
b If your script code is very large, then you can make a JavaScript file and add its path in the following way:
http://www.codeproject.com/Articles/620811/LatestJavaScriptInterviewQuestionsandAnswers
1/9
2/6/2016
LatestJavaScriptInterviewQuestionsandAnswersPDFCodeProject
Code
Hide Copy Code
Code
Hide Copy Code
There are following ways to access the value of the above textbox:
Hide Copy Code
or:
we can use the old way:
Hide Copy Code
Note: This uses the "" attribute of the element to locate it.
9 What are the ways of making comments in JavaScript?
Ans:
Hide Copy Code
http://www.codeproject.com/Articles/620811/LatestJavaScriptInterviewQuestionsandAnswers
2/9
2/6/2016
LatestJavaScriptInterviewQuestionsandAnswersPDFCodeProject
ex:
Hide Copy Code
10 How will you get the status whether it is checked or not?
Ans:
Hide Copy Code
will return or .
11 How to create arrays in JavaScript?
Ans:There are two ways to create array in JavaScript like other languages:
a The first way to create array
Declare Array:
Code
Hide Copy Code
b This is the second way:
Hide Copy Code
12 If an array with name as "names" contain three elements, then how will you print the third element of this array?
Ans: Print third array element
Note: Array index starts with .
13 How do you submit a form using JavaScript?
Ans:Use
14 What does isNaN function do?
Ans: It returns if the argument is not a number.
Example:
Code
Hide Copy Code
The output will be:
Hide Copy Code
http://www.codeproject.com/Articles/620811/LatestJavaScriptInterviewQuestionsandAnswers
3/9
2/6/2016
LatestJavaScriptInterviewQuestionsandAnswersPDFCodeProject
Code
Hide Copy Code
16 What do you understand by this keyword in JavaScript?
Ans: In JavaScript the is a contextpointer and not an object pointer. It gives you the topmost context that is placed
on the stack. The following gives two different results in the browser, where bydefault the object is the 0level
context:
Hide Copy Code
17 What does "1"+2+4 evaluate to?
Ans: Since is a , everything is a , so the result is .
18 What does 3+4+"7" evaluate to?
Ans: Since and are integers, this is number arithmetic, since is a , it is concatenation, so is the result.
19 How do you change the style/class on any element using JavaScript?
Ans:
Code
Hide Copy Code
or
Hide Copy Code
20 Does JavaScript support foreach loop?
Ans: JavaScript 1.6ECMAScript 5th Edition support foreach loop,
See example here http://jsfiddle.net/gpDWk/
21 What looping structures are there in JavaScript?
Ans: , , loops
22 What is an object in JavaScript, give an example?
Ans: An object is just a container for a collection of named values:
// Create the object
Code
Hide Copy Code
http://www.codeproject.com/Articles/620811/LatestJavaScriptInterviewQuestionsandAnswers
4/9
2/6/2016
LatestJavaScriptInterviewQuestionsandAnswersPDFCodeProject
23 How you will add function as a property in a JavaScript object? Give an example.
Ans:
Code
Hide Copy Code
24 What is the similarity between the 1st and 2nd statement?
1st:
2nd:
Ans: Both will call constructor function
You can confirm it by running the following statement:
Hide Copy Code
25 What will be the output of the following statements?
Code
Hide Copy Code
26 Consider the following statements and tell what would be the output of the logs statements?
Hide Copy Code
Ans:
Hide Copy Code
27 What would be the output of the following statements?
Hide Copy Code
http://www.codeproject.com/Articles/620811/LatestJavaScriptInterviewQuestionsandAnswers
5/9
2/6/2016
LatestJavaScriptInterviewQuestionsandAnswersPDFCodeProject
Ans: // Logs false, JavaScript does not care that they are identical and of the same object type.
When comparing complex objects, they are equal only when they reference the same object i.e., have the same address.
Two variables containing identical objects are not equal to each other since they do not actually point at the same object.
28 What would be the output of the following statements?
Code
Hide Copy Code
Ans: // Logs true
29 What is this?
Hide Copy Code
Ans: Three dimensional array
30 Name any two JavaScript functions which are used to convert nonnumeric values into numbers?
Ans:
Hide Copy Code
Code
Hide Copy Code
31 Does JavaScript Support automatic type conversion, If yes give example.
Ans: Yes! Javascript support automatic type conversion. You should take advantage of it, It is most common way of type
conversion used by Javascript developers.
Ex.
Hide Copy Code
*Question31 suggested by Florian Rappl
License
This article, along with any associated source code and files, is licensed under The Code Project Open License CPOL
http://www.codeproject.com/Articles/620811/LatestJavaScriptInterviewQuestionsandAnswers
6/9
2/6/2016
LatestJavaScriptInterviewQuestionsandAnswersPDFCodeProject
Share
EMAIL
SAPrefs Netscapelike
Preferences Dialog
40 important HTML 5
Interview questions with
answers
Go
First Prev Next
My vote of 4
Ujjval Shukla
10Jul15 23:01
7/9
2/6/2016
LatestJavaScriptInterviewQuestionsandAnswersPDFCodeProject
My vote of 4
Novakovi 3Nov14 4:18
Thanks
Girish Nama
17Oct14 19:13
My Vote 5
Shemeemsha RA
6Oct14 20:52
My vote of 5
Sibeesh KV 16Sep14 0:07
Very simple for the beginners
rvasif 3Apr14 6:41
Please improve the answer to question 7
gwag 3Apr14 1:40
My vote of 1
Member 10394796
Nice job
chait301
2Apr14 8:15
4Mar14 4:02
30Sep13 5:38
My vote of 3
DhruvSakalley
8Sep13 15:33
My vote of 4
Member 10004231
30Aug13 0:52
My vote of 5
teeoneone 28Aug13 0:32
My vote of 4
Nitij Kumar 27Aug13 2:26
My vote of 5
Juhi Paunikar
26Aug13 23:48
My vote of 5
Sk. Tajbir 26Aug13 5:04
Another BIG mistake
Florian Rappl 25Aug13 20:35
Re: Another BIG mistake
Vikasahlawat24 25Aug13 21:12
Re: Another BIG mistake
Florian Rappl 26Aug13 0:09
http://www.codeproject.com/Articles/620811/LatestJavaScriptInterviewQuestionsandAnswers
8/9
2/6/2016
LatestJavaScriptInterviewQuestionsandAnswersPDFCodeProject
1 2 Next
News
Suggestion
Question
Bug
Answer
Joke
Praise
Rant
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160204.4 | Last Updated 3 Apr 2014
Select Language
http://www.codeproject.com/Articles/620811/LatestJavaScriptInterviewQuestionsandAnswers
9/9