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.
var is the keyword in Javascript that declares a variable.
var CompanyName = "TechStudy";
alert is keyword in Javascript that displays a message box.
; is the character that ends every statement.
5) Correct the following Javascript statement.
alert “Hello world!”;
alert("Hello world!");
var num = 10;
Also check Top C# interview questions and answers
Also check Top 100 sql server queries interview questions
Modulus Operator (%)
var num = 20 % 6;
Answer -> 2
a++; or ++a;
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.
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.
a = a + 1;
Concatenation, e.g – var num = “10” + “5”;
105, When strings and numbers mixes together in javascript, numbers are converted to strings.
prompt, is the keyword that displays a box requesting user input.
==, ===, !=, !==, >, and <, >=, <=
Array.
function, is a block of code in Javascript that executes whenever you invoke its name.
// This is a sample single line comment.
/*
This is a Multiline
comment example.
*/