Top 200 javascript interview questions | javascript examples

Top 200 javascript interview questions | javascript examples


In this article, you will find basics to advanced javascript interview questions with an example. This article is very useful for those who are preparing for an interview in IT company. Whether you are experienced or fresher, this article will cover all javascript questions from basic to advanced level.


1) What is the keyword in Javascript that declares a variable?

var is the keyword in Javascript that declares a variable.

2) How to define a string variable in Javascript?
  1. var CompanyName = "TechStudy";
3) What is the keyword in Javascript that displays a message box?

alert is keyword in Javascript that displays a message box.

4) What is the character that ends every statement.

; is the character that ends every statement.

5) Correct the following Javascript statement.

alert"Hello world!";

  1. alert("Hello world!");
6) How to define a number to a variable in Javascript?
var num = 10;
7) What is the name of the arithmetic operator in Javascript that gives you the remainder when one number is divided by another?

Modulus Operator (%)
var num = 20 % 6;
Answer -> 2

8) What is the short form of a = a + 1;

a++; or ++a;

9) What is the value of b?
var a = 50;
var b = a++;

50, When the plus plus(++) comes after the variable, its original value is assigned to the new variable before the incrementing variable is incremented.

10) What is the value of b?
var a = 50;
var b = --a;

49, When the minus minus(--) comes before the variable, it is decremented before its value is assigned to the new variable.

     

11) What is the long version of a++?

a = a + 1;

12) What is it called when you combine two or more strings in Javascript, using the plus(+) sign?

Concatenation, e.g - var num = "10" + "5";

13) alert("10" + 5); What message displays in the alert box?

105, When strings and numbers mixes together in javascript, numbers are converted to strings.

14) What is the keyword that displays a box requesting user input?

prompt, is the keyword that displays a box requesting user input.

15) What are the list of Comparison Operators in Javascript?

==, ===, !=, !==, >, and <, >=, <=

16) What is a variable that represents a list of values?

Array.

17) what is a block of code in Javascript that executes whenever you invoke its name?

function, is a block of code in Javascript that executes whenever you invoke its name.

18) What is the tag for commenting 1 line at a time in Javascript?

// This is a sample single line comment.

19) How to define multiline comment in Javascript?

/*
This is a Multiline
comment example.
*/

20) What are the opening and closing tags that enclose JavaScript code in HTML?
<script></script>
     


1 2 3

Responses




Popular Posts

Facebook

Founded in 2016, Tech Study passionately delivers stylish and dynamic innovative information to programmer & technology lovers. http://www.techstudy.org/.