Expert JavaScript Developer Interview Preparation Guide

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
Tweet Share WhatsApp

58 Expert JavaScript Developer Questions and Answers:

1 :: Explain JavaScript?

JavaScript is a general-purpose programming language designed to let programmers of all skill levels control the behavior of software objects. The language is used most widely today in Web browsers whose software objects tend to represent a variety of HTML elements in a document and the document itself. But the language can be--and is--used with other kinds of objects in other environments. For example, Adobe Acrobat Forms uses JavaScript as its underlying scripting language to glue together objects that are unique to the forms generated by Adobe Acrobat. Therefore, it is important to distinguish JavaScript, the language, from the objects it can communicate with in any particular environment. When used for Web documents, the scripts go directly inside the HTML documents and are downloaded to the browser with the rest of the HTML tags and content.

JavaScript is a platform-independent, event-driven, interpreted client-side scripting and programming language developed by Netscape Communications Corp. and Sun Microsystems.
Download Expert JavaScript Developer PDF Read All 58 Expert JavaScript Developer Questions

2 :: How to submit a form using JavaScript?

Use document.forms[0].submit()

(0 refers to the index of the form - if we have more than one form in a page, then the first one has the index 0, second has index 1 and so on).

3 :: What's relationship between JavaScript and ECMAScript?

ECMAScript is yet another name for JavaScript (other names include LiveScript). The current JavaScript that you see supported in browsers is ECMAScript revision 3.

4 :: How to detect the operating system on the client machine?

In order to detect the operating system on the client machine, the navigator.appVersion string (property) should be used.

5 :: Do you convert numbers between different bases in JavaScript?

Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt (" 3F" , 16).
Download Expert JavaScript Developer PDF Read All 58 Expert JavaScript Developer Questions

6 :: How to create arrays in JavaScript?

We can declare an array like this
var scripts = new Array()
We can add elements to this array like this

scripts[0] = " PHP"
scripts[1] = " ASP"
scripts[2] = " JavaScript"
scripts[3] = " HTML"

Now our array scripts have 4 elements inside it and we can print or access them by using their index number. Note that index number starts from 0. To get the third element of the array we have to use the index number 2. Here is the way to get the third element of an array.
document.write(scripts[2])
We also can create an array like this
var no_array = new Array(21, 22, 23, 24, 25)

7 :: Do you target a specific frame from a hyperlink in JavaScript?

Include the name of the frame in the target attribute of the hyperlink in JavaScript. < a href="http://www.globalguideline.com" target="myframe"> Global Guide Line< /a>

8 :: What are fixed-width table and its advantages in JavaScript?

Fixed width tables are rendered by the browser based on the widths of the columns in the first row, in JavaScript resulting in a faster display in case of large tables. Use the CSS style table-layout:fixed to specify a fixed width table.
If the table is not specified to be of fixed width in JavaScript, the browser has to wait till all data is downloaded and then infer the best width for each of the columns. This process can be very slow for large tables.

9 :: Example of using Regular Expressions for syntax checking in JavaScript?

var re = new RegExp(" ^(&[A-Za-z_0-9]{1,}=[A-Za-z_0-9]{1,})*$" )
var text = myWidget.value
var OK = re.test(text)
if( ! OK ) {
alert(" The extra parameters need some work. Should be something like: " &a=1&c=4" " )
}

10 :: How to add Buttons in JavaScript?

The most basic and ancient use of buttons are the " submit" and " clear" , which appear slightly before the Pleistocene period. Notice when the " GO!" button is pressed it submits itself to itself and appends the name in the URL.
< form action=" " name=" buttonsGalore" method=" get" >
Your Name: < input type=" text" name=" mytext" />
< br />
< input type=" submit" value=" GO!" />
< input type=" reset" value=" Clear All" />
< /form>

Another useful approach is to set the " type" to " button" and use the " onclick" event.
< script type=" text/javascript" >
function displayHero(button) {
alert(" Your hero is " " +button.value+" " ." )
}
< /script>

< form action=" " name=" buttonsGalore" method=" get" >
< fieldset style=" margin: 1em text-align: center " >
< legend> Select a Hero< /legend>
< input type=" button" value=" Agamemnon" onclick=" displayHero(this)" />
< input type=" button" value=" Achilles" onclick=" displayHero(this)" />
< input type=" button" value=" Hector" onclick=" displayHero(this)" />
< div style=" height: 1em " />
Download Expert JavaScript Developer PDF Read All 58 Expert JavaScript Developer Questions