• LOGIN
  • No products in the cart.

Javascript Intervew Questions

What is JavaScript?

JavaScript is a client-side as well as server side scripting language that can be inserted into HTML pages and is understood by web browsers. JavaScript is also an Object Oriented Programming language

Enumerate the differences between Java and JavaScript?

Java is a complete programming language. In contrast, JavaScript is a coded program that can be introduced to HTML pages. These two languages are not at all inter-dependent and are designed for the different intent.  Java is an object – oriented programming (OOPS) or structured programming language like C++ or C whereas JavaScript is a client-side scripting language and it is said to be unstructured programming.

What are JavaScript types?

Following are the JavaScript types:

  • Number
  • String
  • Boolean
  • Function
  • Object
  • Null
  • Undefined
Are you Looking for Java Script Training? Please Enroll for Demo Java Script..!

What is the use of isNaN function?

isNan function returns true if the argument is not a number otherwise it is false.

What is called Variable typing in Javascript?

Variable typing is used to assign a number to a variable and the same variable can be assigned to a string.

Example

This is called variable typing.

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

The parseInt() function is used to convert numbers between different bases. parseInt() takes the string to be converted as its first parameter, and the second parameter is the base of the given string.

In order to convert 4F (of base 16) to integer, the code used will be –

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

“==” checks only for equality in value whereas “===” is a stricter equality test and returns false if either the value or the type of the two variables are different.

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

Since 3 and 2 are integers, they will be added numerically. And since 7 is a string, its concatenation will be done. So the result would be 57.

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

In order to detect the operating system on the client machine, the navigator.appVersion string (property) should be used.

What do mean by NULL in Javascript?

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.

What is the function of delete operator?

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.

What is an undefined value in JavaScript?

Undefined value means the

  • Variable used in the code doesn’t exist
  • Variable is not assigned to any value
  • Property doesn’t exist

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

  • Alert
  • Confirm and
  • Prompt

What is the use of Void(0)?

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.

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

The following code has to be inserted to achieve the desired effect:

What is the data type of variables of in JavaScript?

All variables in the JavaScript are object data types.

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

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

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

What are escape characters?

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.

Example:

What are JavaScript Cookies?

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.

Explain what is pop()method in JavaScript?

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

Whether JavaScript has concept level scope?

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

Mention what is the disadvantage of using innerHTML in JavaScript?

If you use innerHTML in JavaScript the disadvantage is

  • Content is replaced everywhere
  • We cannot use like “appending to innerHTML”
  • Even if you use +=like “innerHTML = innerHTML + ‘html’” still the old content is replaced by html
  • The entire innerHTML content is re-parsed and build into elements, therefore its much slower
  • The innerHTML does not provide validation and therefore we can potentially insert valid and broken HTML in the document and break it
Are you Looking for Java Script Online Training? Please Enroll for Demo Java Script..!

What is break and continue statements?

Break statement exits from the current loop.

Continue statement continues with next statement of the loop.

What are the two basic groups of dataypes in JavaScript?

They are as –

  • Primitive
  • Reference types.

Primitive types are number and Boolean data types. Reference types are more complex types like strings and dates.

How generic objects can be created?

Generic objects can be created as:

November 2, 2019
GoLogica Technologies Private Limited. All rights reserved 2024.