JavaScript Interview Question

Get All latest JavaScript Interview Question.Important interview question in Javascript.

JavaScript Interview Question
JavaScript Interview Question

Q. What is Javascript ?
JavaScript is client-side scripting language that can be imported in HTML webpage and is executed on clients Browser.
Q. How to write hello world program in Javascript ?
Simple example of javascript hello world is shown below.You need to use this code in body tag of html.

Q. What are JavaScript types ?
• String
• Number
• Boolean
• Null
• Object
• Function
• Undefined
Q. Is JavaScript is case sensitive language.?
Yes
Q. How to use external JavaScript file ?

<script type=”text/javascript” src=”phpcluster.js”></script>

Q. What is negative infinity ?

Negative infinity is a number which can be derived by dividing negative number by zero in JavaScript.

Q. What is BOM?

BOM stands for Browser Object Model. It gives interaction with Browser. The default object of Browser is Window.

Q. What is DOM ?

DOM stands for Document Object Model. A Document object represents to html documents.It can be used to access html content and its changes.

Q. What are undeclared and undefined variables?

Undeclared variable are those variable which don’t exists and not declared in a program. If the program try to get the variable value ,then it gives runtime error .

Undefined variable are those variable which are declared in a program but have not assign any value. If program try to read the value of variable it gives undefined value.

Q. What is a prompt box in JavaScript?

A prompt box is a box which allow the user to enter a input by providing text box.Box will be provided to enter a text or numeric value.

Q. How to write comment in JavaScript ?

There are two types of comments used in JavaScript.

  • Single line comment . (represented by // double forward slash)
  • Multi line comment. (represented by slash with asterisk symbol as /* comment here */)

Q. How to create function in JavaScript?

To create function in JavaScript, follow the following syntax.

<script>

function  functionname(){

//body of function

}

</script>

Q. What are the data types in JavaScript?

There are two types of data types in JavaScript:

  • Primitive Data Types
  • Non-primitive Data Types

Q. Why ‘this’ keyword used in JavaScript?

‘This’ keyword is used in to point at the current object in the JavaScript code.

Q. What is the output of “2”+10+15 in JavaScript?

21015 Reason: after string all the +(sign) will be treated as string concatenation operator. In JavaScript + sign is used for string concatenation.

Leave a Comment