Expert JavaScript Developer

  Home  Client Side Scripting  Expert JavaScript Developer


“Expert JavaScript Developer Frequently Asked Questions in various Expert JavaScript Developer job Interviews by interviewer. The set of questions here ensures that you offer a perfect answer posed to you. So get preparation for your new job hunting”



208 Expert JavaScript Developer Questions And Answers

141⟩ What are the different actions that are performed using JavaScript?

► JavaScript allows the computer to be more secure by putting the privacy policies and disable the unauthorized access to the files.

► It allows many actions to be performed like, setting the browser's preferences and receiving the request from the servers for the client computer.

► The settings that are used gets saved on the client side on the features like actions buttons, appearance and printing.

► It allows easy launching of an application on the client computer with interactive data to be communicated between the server and the client.

► It allows reading and writing of files or directories on the client or server side.

► It allows easy capturing of the data that is live streamed from the server to the client machine for retransmission.

► It also allows to safe and secure the application from the outside world.

 218 views

142⟩ What is the importance of <SCRIPT> tag?

► JavaScript is used inside <SCRIPT> tag in HTML document. The tags that are provided the necessary information like alert to the browser for the program to begin interpreting all the text between the tags.

► The <script> tag uses JavaScript interpreter to handle the libraries that are written or the code of the program.

► JavaScript is a case sensitive language and the tags are used to tell the browser that if it is JavaScript enabled to use the text written in between the <Script> and </Script> tags.

► The example is given as:

<HTML>

<HEAD>

<!--

<SCRIPT> // Starting of the scripting language

//Your code here

</SCRIPT> --> // End of the scripting language

</HEAD>

<BODY>

// your code here

</BODY>

</HTML>

 218 views

144⟩ What are the different objects used in JavaScripts?

JavaScript uses a hierarchical structure that applies to the objects in a document. There are some objects that show the relationship of one object to another using the language.

Window object :

This is the topmost object in the hierarchy. It represent the content area of browser window that consists of HTML documents. Each frame is also a window that has some actions inside it.

Document object :

This object gets loaded in a window and consists of objects of different kind in the model. It consists of the content that will be written in the script.

Form object :

Form objects are used for more interaction with the users. It represents the form elements inside <FORM>...</FORM> tag.

 233 views

147⟩ 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:

JavaScript

function myfunction()

{

"use strict";

var v = "This is a strict mode function";

}

 215 views

148⟩ What are the main functions performed by JavaScript Statements?

The <SCRIPT> Script statement(s) </SCRIPT> tag consists of JavaScript statement. Just to be compatible with all the browsers it is been written in comments and it also accepts a semicolon(;) at the end of every statement. JavaScript also uses the carriage return at the end of a statement. Every statement has a purpose like:

- Define or initialize a variable that will be used in an object when executing the script

- Assign a value to a property or variable so that user inputs can be taken according to the values that are defined in it.

- Change the value of a property or variable to give more flexibility to the use of a scripting language.

- Invoke an object's method to allow faster processing of the system

- Invoke a function routine to allow the function to perform various activities so that the application can run at faster speed.

 224 views

150⟩ How do I use JavaScript to password-protect my Web site?

There are several ways in which you can use JavaScript to password-protect your website. This can be done by setting the password by using the given name or pathname of HTML file on your site. Set the location to value entered in the field. Entry of wrong password will result in "invalid URL" error. If password protect pages requires more security then you can set temporary cookies on the page.

 220 views

152⟩ How to manage exception handling in Javascript?

► Javascript provides the features of exception handling using try..catch..finally blocks which is much similar to the C# exception handling blocks.

► We have to write the suspected code in try block and all the exceptions that occur in the try block will be caught in catch block.

► For example :

window.onload = function()

{

try

{

var v1=30;

var v2 =v1/v3;

}

catch(ex)

{

document.write(ex.name + " : " +ex.message);

}

Finally

{

document.write('this is finally block');

}

}

► This code snippet will cause an error :

TypeError : 'v3' is undefined.

 213 views

153⟩ What do mean by NULL in JavaScript?

The NULL value is used to represent no value or no object. It implies no object or null string, no valid boolean value, no number and no array object.

 230 views

155⟩ How to get height and width of different browser in Javascript?

Following examples illustrate the different ways to get height and width of different browser.

For Non-IE:

var Width;

var Height;

Width = window.innerWidth;

Height = window.innerHeight;

For IE 6+ in standards compliant mode :

Width = document.documentElement.clientWidth;

Height = document.documentElement.clientHeight;

For IE 4 compatible:

Width = document.body.clientWidth;

Height = document.body.clientHeight;

 236 views

156⟩ What are the different types of errors supported by JavaScript?

There are many errors that can occur in a system. JavaScript provides a message for all the errors at run time and dynamically generate the error code. The errors that are present :

Load-time errors :

These are the errors that come when loading a web page like using of improper syntax and the errors gets detected the moment user loads a page.

Run-time errors :

These are the errors that comes due to misuse of the language commands used inside the HTML document. This shows that it has loaded but the functionality is not properly integrated.

Logic errors :

These are the errors that comes due to bad logic performed on a function that is having different operation but it is made to have logic differently.

 229 views

157⟩ Why JavaScript is called as Script for all browsers?

JavaScript is written after <SCRIPT> tag and it is surrounded in between the <!-- your code --> tags, this is also known as comment tag. JavaScript interpreter treats the tag such that it treats all the lines in the comments as script lines. The JavaScript comment starts with // inside the <SCRIPT> tag. The script is contained inside <HTML> tag that contains a comment tag. The browser that is non-compatible with JavaScripts ignore the lines and move on, but compatible browsers always treats it as a script and execute it. The browser treat the written lines between the comment tag as normal lines and just thinking of the comment ignores it. Some browsers just treat the <!-- comment--> as a comment only and ignores whatever is written inside it.

 229 views

158⟩ What does dynamic component in JavaScript contain?

Dynamic component is a model that consists of many other sub-components that are based on dynamic theory only like:

Dynamic typing :

These are associated with the values and not having any association with the variables. JavaScript support the use of many types that can be used as an object.

Object based :

JavaScript is an object-oriented language and it deals with the objects that are associated arrays used with prototypes. The properties of the object based component can be modified, removed or added at run-time. The properties are using built in functions that helps to keep the property of dynamicity of the application.

Run-time evaluation :

JavaScript provides a run time evaluation using the eval() that takes some arguments provided during run time. This evaluation is used to make the scripting language more widely used as run time evaluation slows down the system but JavaScript uses the libraries to take less space.

 253 views