Moreover, it not only simplifies the calculation but it also improves the graphics appearance of the websites.
No connection is needed for the server to execute further once it is loaded.
6) How can you differentiate between two words "var" and "let" keyword?
The difference between "var" and "let" keyword is as follows:
- "var" has function scope while "let" has block scope
- "var" gets hoisted but "let" can't be hoisted at the top of its function
<!DOCTYPE html> <html> <body> <h2>The / Operator</h2> <p id="demo"></p> <script> var x = 5; var y = -0; var z = x / y; document.getElementById("demo").innerHTML = z; </script> </body> </html>
The outcome of this equation would be 237. Explanation is:
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var x = "2"; var y = 3; var z = 7; var result = x + y + z; document.getElementById("demo").innerHTML = result; </script> </body> </html>
9) What would be the outcome for the evaluation 2+6+"7"?
10) How you can differentiate between "==" and "==="?
|!ERROR! unexpected operator '='||!ERROR! unexpected operator '='|
|Only checks for equality in value and returns true if values are equal||It also checks for the equality of variable type. if the types of both variables are not identical, it returns false|
|Refers to equal||Refers to the identical equal or strict equality operator|
|While comparing, == also does type comparison||eliminates type conversion while comparing|
The variable that is not present in a program or the variables that are not declared is known as undeclared variables. Runtime error can occur if we try to execute a program with undeclared variables.
Undeclared variables are those variables that are declared but not any value has been provided. An undefined value may return if we try to execute a program containing the undeclared variable.
A prompt box is a box containing label box, text box and various other boxes to allow users to enter any input whether it is text or a numerical.
"This" Keyword provides the reference to the object from where it was called. Generally, "This" keyword represents current content.
14) If we want to remove the focus from the specified object which function can be used?
We can use the Blur Function to remove the focus from the specified object.
For example "apple", not Apple.
|Popup Boxes||The method used to create Pop Boxes|
18) What do you understand by the Unshift method?
This method is identical to the push() method and returns the length of an array. This method can be used when there is a requirement for the insertion of any item to a front of an array.
There are mainly two techniques for Array Creation.
a) The First method is to declare an Array:
var colors = new Array();
Add item in Array:-
colors  = "Red";
colors  = "yellow";
colors  = "black";
b) The Second Method is
var colors = new Array("Red", "Yellow", "Black");
22) If there is an Array name as "colors" which contains four elements, then how can we print the 4th element?
The 4th element can be printed by document.write(colors);
document.write(isNaN("Friends")+ "<br>" ); document.write(isNaN(567)+ "<br>" );Output:
You need to add one line in the Head Section to redirect a URL.
console.log(4 + '4'); //44
console.log(4 - '4'); //0
25) Which method returns the character at the specified index?
charAt method returns the character at the specified index.
26) What is the role of navigator.app version string?
Role of the navigator.app version string is to detect the OS of the client machine.
28) Which function can be used to convert URL into their Hex coding?
encodeURL() can be used to convert URL into their Hex coding.
With a single name, the variable, functions, properties, etc can be grouped with Namespacing. Namespacing raises coding modularity, permits code re-usability, and to use libraries without the overhead of overwriting functions.
30) Is the alert box and confirmation box are similar?
No, they are not the same. Their difference can be found in the button. An alert box contains only one OK button whereas a confirmation box contains two buttons i.e. Cancel and OK.
If you think I have missed out on any important question, you can comment and I will surely update that with this list.
Do share this interview questions so that your friends can also reach to this list.