Latest JavaScript Interview Questions and Answers PDF - CodeProject
Short Description
Download Latest JavaScript Interview Questions and Answers PDF - CodeProject...
Description
2/6/2016
Latest JavaScript Interview Questions and Answers PDF CodeProject
12,062,666 members ﴾47,291 online﴿ Sign up for our free weekly Web Developer Newsletter.
articles
Q&A
forums
Sign in
×
Search for articles, questions, tips
lounge
Latest JavaScript Interview Questions and Answers PDF Vikas ahlawat ‐ www.tutoriz.com, 3 Apr 2014
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....
JavaScript Interview Questions for both Experienced Programmers and Freshers 1﴿ What is JavaScript? Ans:JavaScript is a scripting language most often used for client‐side web development. 2﴿ What is the difference between JavaScript and Jscript? Ans:Both JavaScript and Jscript are almost similar. JavaScript was developed by Netscape. Microsoft reverse engineered Javascript and called it JScript. 3﴿ How do we add JavaScript onto a web page? Ans:There are several way for adding JavaScript on a web page, but there are two ways which are commonly used by developers If your script code is very short and only for single page, then following ways are the best: a﴿ You can place ʳ
ʰɑŵ
ɑʴ tag inside the ʳʴ element.
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
Latest JavaScript Interview Questions and Answers PDF CodeProject
Code Hide Copy Code
ʳʴ ʳʴʳŵʴ ʳ
ʰɑŵ
ɑ
ʰɑ
Ŝɑʴʳŵ
ʴ ʳŵʴ 4﴿ Is JavaScript case sensitive? Ans:Yes! A function is not the same as . 5﴿ What are the types used in JavaScript? Ans:, , ,
,
, , . 6﴿ What are the boolean operators supported by JavaScript? And Operator: && Or Operator: || Not Operator: ! 7﴿ What is the difference between “==” and “===”? Ans: “==” checks equality only, “===” checks for equality as well as the type. 8﴿ How to access the value of a textbox using JavaScript? Ans: ex:‐
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
Latest JavaScript Interview Questions and Answers PDF CodeProject
ŵƋ Ƌŵ
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
Latest JavaScript Interview Questions and Answers PDF CodeProject
15﴿ What is the use of Math Object in JavaScript? Ans: The math object provides you properties and methods for mathematical constants and functions. ex:‐
Code Hide Copy Code
ʰŜ Śŵŵ ʰŜſɨɭƀŚŵŵɮɳ ʰŜſɰɥƀŚɰɥ 16﴿ What do you understand by this keyword in JavaScript? Ans: In JavaScript the is a context‐pointer and not an object pointer. It gives you the top‐most context that is placed on the stack. The following gives two different results ﴾in the browser, where by‐default the object is the 0‐level 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.6﴾ECMAScript 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
Latest JavaScript Interview Questions and Answers PDF CodeProject
ʰ
ſƀŚ ŜʰɐɐŚ ŜʰŚ ŜʰɩɮŚ 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
Latest JavaScript Interview Questions and Answers PDF CodeProject
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
ʰɐɬɐŚ ʰƋɨŚ ʰʫŚ ſƀŚŵŵɗɗ ſƀŚŵŵɗɗ ſƀŚŵŵɗɗ *Question﴾31﴿ 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
Latest JavaScript Interview Questions and Answers PDF CodeProject
Share EMAIL
TWITTER
About the Author
You may also be interested in... ASP.NET MVC interview questions with answers
Proven Practices for Upgrading or Migrating to Microsoft SharePoint 2013
Latest jQuery interview questions and answers
SAPrefs ‐ Netscape‐like Preferences Dialog
40 important HTML 5 Interview questions with answers
Window Tabs ﴾WndTabs﴿ Add‐In for DevStudio
Comments and Discussions You must Sign In to use this message board. Search Comments
Go First Prev Next
My vote of 4 Ujjval Shukla
10‐Jul‐15 23:01
More Javascript interview quizzes Member 11797151 27‐Jun‐15 14:07 Just my opinion Dávid Kocsis 26‐May‐15 3:47 http://www.codeproject.com/Articles/620811/LatestJavaScriptInterviewQuestionsandAnswers
7/9
2/6/2016
Latest JavaScript Interview Questions and Answers PDF CodeProject
My vote of 4 Novakovi 3‐Nov‐14 4:18 Thanks Girish Nama
17‐Oct‐14 19:13
My Vote 5 Shemeemsha RA
6‐Oct‐14 20:52
My vote of 5 Sibeesh KV 16‐Sep‐14 0:07 Very simple for the beginners rvasif 3‐Apr‐14 6:41 Please improve the answer to question 7 gwag 3‐Apr‐14 1:40 My vote of 1 Member 10394796 Nice job chait301
2‐Apr‐14 8:15
4‐Mar‐14 4:02
Great and Simple Endalew 17‐Oct‐13 12:41 Thanks oddadmix
30‐Sep‐13 5:38
My vote of 3 DhruvSakalley
8‐Sep‐13 15:33
My vote of 4 Member 10004231
30‐Aug‐13 0:52
My vote of 5 teeoneone 28‐Aug‐13 0:32 My vote of 4 Nitij Kumar 27‐Aug‐13 2:26 My vote of 5 Juhi Paunikar
26‐Aug‐13 23:48
My vote of 5 Sk. Tajbir 26‐Aug‐13 5:04 Another BIG mistake Florian Rappl 25‐Aug‐13 20:35 Re: Another BIG mistake Vikasahlawat24 25‐Aug‐13 21:12 Re: Another BIG mistake Florian Rappl 26‐Aug‐13 0:09 http://www.codeproject.com/Articles/620811/LatestJavaScriptInterviewQuestionsandAnswers
8/9
2/6/2016
Latest JavaScript Interview Questions and Answers PDF CodeProject
Always prefer literals ... Florian Rappl 25‐Aug‐13 20:26 question 20's answer is not correct, or not up to date David Rogers Dev 25‐Aug‐13 17:06 Re: question 20's answer is not correct, or not up to date Vikasahlawat24 25‐Aug‐13 18:14 Refresh General Admin
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 ▼ Layout: fixed | fluid Article Copyright 2013 by Vikas ahlawat ‐ www.tutoriz.com Everything else Copyright © CodeProject, 1999‐2016
http://www.codeproject.com/Articles/620811/LatestJavaScriptInterviewQuestionsandAnswers
9/9
View more...
Comments