Javascript Interview Questions and Answers – Part6

51.  What is the difference between JavaScript and Jscript?
Both JavaScript and Jscript are almost similar. JavaScript was developed by Netscape. Microsoft reverse engineered Javascript and called it JScript.

52.  Is JavaScript case sensitive?
A function getElementById is not the same as getElementbyID.

53. What is the use of Push method in JavaScript?
The push method is used to add or append one or more elements to the end of an Array. Using this method, we can append multiple elements by passing multiple arguments.

54. How do we add JavaScript onto a web page?
There are several way for adding JavaScript on a web page, but there are two ways which are commonly used by developers
If your script code is very short and only for single page, then following ways are the best:
a) You can place <script type=”text/javascript”> tag inside the <head> element.

<title>Page Title</title>
<script language="JavaScript" type="text/javascript">
var name = "Vikas Ahlawta"

b) If your script code is very large, then you can make a JavaScript file and add its path in the following way:

<title>Page Title</title>
<script type="text/javascript" src="myjavascript.js"></script>

55. What is unshift method in JavaScript?
Unshift method is like push method which works at the beginning of the array. This method is used to prepend one or more elements to the beginning of the array.

56. What are the types used in JavaScript?
String, Number, Boolean, Function, Object, Null, Undefined.

57. How are object properties assigned?
Properties are assigned to objects in the following way –
1 obj[“class”] = 12;
1 obj.class = 12;
58. What is the ‘Strict’ mode in JavaScript and how can it be enabled?
Strict Mode adds certain compulsions to JavaScript. Under the strict mode, JavaScript shows errors for a piece of codes, which did not show an error before, but might be problematic and potentially unsafe. Strict mode also solves some mistakes that hamper the JavaScript engines to work efficiently.
Strict mode can be enabled by adding the string literal “use strict” above the file. This can be illustrated by the given example:

 function myfunction()
“use strict";
var v = “This is a strict mode function";

59.  What are the boolean operators supported by JavaScript?
And Operator: &&
Or Operator: ||
Not Operator: !

60.  What is the way to get the status of a CheckBox?
The status can be acquired as follows –
If the CheckBox will be checked, this alert will return TRUE.

Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 2 = three

Popup Dialog Box Powered By :
  • RSS
  • Facebook
  • Google+
  • Twitter