• RSS Unknown Feed

    • An error has occurred; the feed is probably down. Try again later.
  • Meta

JavaScript – Beginning Interview Questions

In doing numerous technical interviews of Internet Application Developers, I’ve discovered that most of these candidates consider their JavaScript skills to be at an “expert” level or they feel their JavaScript skills are “very strong.” In the course of the interview, however, it is often discovered that the candidates only have a cursory understanding of the JavaScript programming language. Based on my experience, I have written 20 questions that someone claiming to know JavaScript should be able to answer:

What have you used JavaScript for?
Typical answers include form validations, user action confirmations, updating an Internet page dynamically and other such answers. I usually ask this question first just to get the candidate talking about JavaScript and see if they have in fact used JavaScript for something.

How do you access an element in an HTML document with JavaScript?
Give the element an ID attribute and then use JavaScript’s getElementById() function to access that element.

How do you determine how many characters are in a JavaScript string?
With the length property of the JavaScript string object.

What datatypes are supported by JavaScript?
Number, String, Undefined, null, Boolean. At a minimum, the candidate should identify Number and String.

How do you create a date in JavaScript?
With the Date object: new Date()

Where does JavaScript date object pull it’s date from?
From the client machine.

What does the isNaN function do?
Returns true is the value provided is not a numeric value and false if the number provided is a numeric value.

What is the difference between JavaScript and Java?
They are completely different languages.

How do you comment JavaScript code?
For single-line comments, begin the line with consecutive forward slashes (//). To comment a block of code, wrap it with /* code */.

What is the JavaScript concatenation operator?
The plus sign.

How do you call an external JavaScript file?
With the script tag, using the src attribute to reference the path of the JavaScript file.

How do you create a function in JavaScript?
Use the function statement.

How do you get the item selected in a dropdown select list?
With the selectedIndex property

How do you open a new window?
With window.open

How do you remove all options from a dropdown select list?
By setting the length property of the dropdown select list to 0.

Demonstrate the syntax for writing a FOR loop.
Need an answer similar to:
for (i=1;i<=LoopNumber;i++)
{
//do something
}

How do you determine the length of an array?
With the length property of the array object

How do you load a new URL in a browser?
With the location or href property of the window or document object.

What are the different usages of equal signs?
One (=) is for assignment. Two (==) is for equality. Three (===) is for strict comparison.

What is ++ used for
It is the increment operator. It adds one to a value.