article

javascript interview questions

[WHAT]

  1. ] The top 85 javascript interview questions by careerguru.com - SUMMARY of the the "top" 85 javascript interview questions, with answers - mine and theirs
    1. [2015-05-30] first page result(# #) for g qry "javascript interview questions"

[WHY]

  1. ] test your javascript knowledge
  2. ] prepare for your javascript interview
  3. ] learn more about javascript

[WHERE]

  1. ] REVIEW OUR FULL LIST OF JAVASCRIPT INTERVIEW QUESTIONS
    1. ] javascript interview - questions and answers?- 101+ javascript interview questions, compiled from several different sources, organized into categories, ranked by difficulty(beginner, intermediate, advanced) . User our javascript interview questions app to practice your answers or review the answers.
  2. ] READ THE FULL ARTICLE
    1. ] top 85 javascript interview questions with - by career guru

[WHEN]

  1. ] 2015-05-30

[EXAMPLE]

  1. ] What is javascript?
  2. ] Enumerate the differences between java and javascript
  3. ] Name the javascript types?
  4. ] What is the use of the isNan function?
  5. ] What is faster, asp are javascript?
  6. ] What is Negative Infinity?
  7. ] Can you break javascript code into several lines?
  8. ] Which company developed javascript?
  9. ] What are undeclared and undefined variables?
  10. ] Write code to add new elements dynamically
  11. ] ....
  12. x] 40 What is break and continue statements?
  13. x] What are the two basic groups of dataypes in JavaScript?
  14. x] 43. How generic objects can be created?
  15. x] 44. What is the use of type of operator?
  16. x] 45. Which keywords are used to handle exceptions?
  17. x] 46 Which keyword is used to print the text in the screen?
  18. x] 47. What is the use of blur function?
  19. x] 48. What is variable typing?
  20. x] 49. How to find operating system in the client machine using JavaScript?
  21. x] 50 What are the different types of errors in JavaScript?

[HOW-TO]

  1. ]

[REFERENCE]

  1. ] RESEARCH g qry "javascript interview question", 2015-06-30
    1. ] r# 5 - top 85 javascript interview questions with - by career guru
  2. ] tech-dev-www/language-javascript/interview-questions
    1. ] # # - have mapped out all of these questions into our database - i have categorized each of these questions and combined them with some additional javascript questions from a few other sources. Each "Question" record/page content displays "my answer" , "source answer".

 

 



> 11]  what are global variables?
- variables that are accessible from any code in your application. They have global scope.
- declared outside of any function in your script
- problems they are accessible to any code
-- muteable - many different functions can access/set the values of these variables,

> 12]  what is a prompt box
- asks the user to confirm or deny an action, can be configured with different option, ex YES|| NO, OK || CANCEL,

- CORRECT ANSWER
- input box, gets a value from the user
- ex var age = prompt("how old are you?");

- what i described does exist, was a 'confirm' prompt, now

> 13] What is ‘this’ keyword in JavaScript?

 the 'this' keyword in javascript refers to the currently in scope object,

example in a new object contructor method for an object with properties  of id and name,

this.id = 123

this.name = "joe"

there are special circumstances where .this may refer to something other than what you think it may be referring to

> 14]  Explain the working of timers in JavaScript? Also elucidate the drawbacks of using the timer, if any?

js has a setTimeout method() which you can use to delay execution of code by a specified time value. One drawback is that it blocks the execution of all code when you use the timeout method.

> 15] Which symbol is used for comments in Javascript?

// for single line comments

/* for multi line or block

comments

*/

> 16] What is the difference between ViewState and SessionState?

session is typically an app var to manage sites users

view is typically an

> 17]  What is === operator?

this is a comparison operator, you should use triple = VS double = in most cases , b/c with triple =, it will NOT convert specific types of vars, where double= will convert some types giving you unpredictable results in your comparison

> 18] Explain how can you submit a form using JavaScript?

document.forms[index].submit() || document.getElementById("formID").submit()

> 19]  Does JavaScript support automatic type conversion?

Yes -

example - comparing string number values in json,

> 20] How can the style/class of an element be changed?

why jq is so nice - $("p").css("new")

document.getElementById("id").styles[0].name="newStyleName"

ANSWER

document.getElementById(myText).style.fontSize=20?;
document.getElementById(myText).className=anyclass;

> 21]  Explain how to read and write a file using JavaScript?

javascript is primarily used in the browser on the client side with no access to the local filesystem. js has no natives methods for file writing and reading.
you can write special files called cookie files, which are limited
html5 spec also brings several additional db options for storing data on the local machine
ANSWER
javascript extensions
active x controls

> 22] What are all the looping structures in JavaScript?

for - a specified number of iteration

while - until a specified condition is met

do while - something until ... specified number of times

 > 23 what is called variable typing in javascript

- js interpreter looks at the var and guesses at what type it should be,

- js interpreter assigns a type to the var depending on the var declaration and assignment statement

- var x = 3;

 > 24 How can you convert the string of any base to integer in JavaScript?

var twentytwo = parseInt("22");

> 25 Explain the difference between “==” and “===”?

triple = is the stricter equality operater, it does not allow for type conversion,

double = will allow for javascripts auto type conversion to kickin and sometimes provide unpredicable results,

x = 3;

y = "3";

example ( if x = y ){alert("true");}

> 26 What would be the result of 3+2+”7″?

57

> 27 Explain how to detect the operating system on the client machine?

ME its a browser property, you could use an if statement in your script to detect which os the browser is running on

ANS

> 28 What do mean by NULL in Javascript?

ME - null means that a variable has been defined(it exists) but it has no value assigned to it ( or has been assigned the value of null )

ANS - The NULL value is used to represent no value or no object.  It implies no object or null string, no valid boolean value, no number and no array object.

> 29. What is the function of delete operator?

ME - delete operator ??? when you say operator i thing >, <, =, ... NOT sure what a delete operator is, assuming we are not talking about a decrement operator, ex numUnits--

ANS -  The functionality of delete operator is used to delete all variables and objects in a program but it cannot delete variables declared with VAR keyword.

> 30. What is an undefined value in JavaScript?

ME a var that does not exist

ANS - Undefined value means the

> 31 What are all the types of Pop up boxes available in JavaScript?

ME - alert(), prompt(), input()

ANS -

> 32 What is the use of Void(0)?

ME:

ANS:

Void(0) is used to prevent the page from refreshing and parameter “zero” is passed while calling.

Void(0) is used to call another method without refreshing the page.


> 33 How can a page be forced to load another page in JavaScript?

ME: window.load("anotherpage.html") location.href = "anotherpage.html"

ANS: location.href="http://newhost/newpath/newfile.html";

> 34 What is the data type of variables of in JavaScript?

ME: var is not a set data type, var is a dynamic data type, var is assigned an object type at runtime based upon the current value of the var, if var = " string" then var is string object, if var is #, then var is number object, ....

ANS

 All variables in the JavaScript are object data types

> 35 What is the difference between an alert box and a confirmation box?

ME - alert box displays a text message to user, a confirmation box displays input options to use (ex OK, CANCEL buttons) where use can proved input to app

ANS -

An alert box displays only one button which is the OK button.

But a Confirmation box displays two buttons namely OK and cancel.

> 36 What are escape characters?

ME: escape characters are used to preface a character that otherwise perform some action, so that it does not perform that action

exampe in js, a string "is defined" by placing the text in quotes, however if you want to include quote characters within the string you would preface the quotes with the javasecript escape character, the backslash (\) which would prevent the quote from terminating the string  

ANS: Escape characters (Backslash) is used when working with special characters like single quotes, double quotes, apostrophes and ampersands. Place backslash before the characters to make it display.

> 37. What are JavaScript Cookies?

ME: javascript cookies are small text files that can be written to a users local hard drive via the web browser. these files typically contain settings or login info or state information.

ANS: Cookies are the small test files stored in a computer and it gets created when the user visits the websites to store information that they need. Example could be User Name details and shopping cart information from the previous visits.

> 38 . Explain what is pop()method in JavaScript?

ME: pop is an array method that enables you to remove an item from the array

ANS: The pop() method is similar as the shift() method but the difference is that the Shift method works at the start of the array.  Also the pop() method take the last element off of the given array and returns it. The array on which is called is then altered.
Example:
var cloths = [“Shirt”, “Pant”, “TShirt”];
cloths.pop();
//Now cloth becomes Shirt,Pant

39. Whether JavaScript has concept level scope?

ME: huh, scope is the reach of your var/function, concept level scope, whats a concept,  

ANS: No. JavaScript does not have concept level scope. The variable declared inside the function has scope inside the function.

> 40. Mention what is the disadvantage of using innerHTML in JavaScript?

ME: dont know

ANS:

If you use innerHTML in JavaScript the disadvantage is

 

 

[REVIEW]

] 29 function of delete operator ] 32 void(0)

http://en.wikipedia.org/wiki/First-class_function


 

Details Photos Edit more

Details

ID: 4560

NAME: javascript-interview-questions

DESCRIPTION: the top 85 javascript interview questions by careerguru.com - SUMMARY of the the "top" 85 javascript interview questions, with answers - mine and theirs

AUTHOR: article.author/s

EDITOR: article.editor/s

PUBLISHER: article.publisher/s

STATUS: Write

PRIORITY: 0

OWNER ID: 75

Content Photos Edit more

photos

page_photo

actions

Email Email-Owner SMS and