JAVASCRIPT QUIZ
1 .
Which of these is a correct method to create a new array?

Correct Answer : Option (B)

var myArray = [];
  Show Answer
2 .
Which of the following way can be used to indicate the LANGUAGE attribute?

Correct Answer : Option (C)

<SCRIPT LANGUAGE="JavaScriptVersion">    JavaScript statements…</SCRIPT>
  Show Answer
3 .
The “if” statement is used to:

Correct Answer : Option (D)

Deal with logic that should execute only when a condition is true
  Show Answer
4 .
How to return the first value of this array? var myArr = [1, 2, 3, 4, 5]; var myVal = …

Correct Answer : Option (A)

myArr[0];
  Show Answer
5 .
Which of the following event fires when the form element loses the focus: <button>, <input>, <label>, <select>, <textarea>?

Correct Answer : Option (B)

onblur
  Show Answer
6 .
How do you define a function called “fName”?

Correct Answer : Option (C)

function fName() { }
  Show Answer
7 .
To set up the window to capture all Click events, we use which of the following statement?

Correct Answer : Option (A)

window.captureEvents(Event.CLICK);
  Show Answer
8 .
Which statement loops through an array?

Correct Answer : Option (C)

for (var i=0; i < myArray.length; i++)
  Show Answer
9 .
What is the value of the array myArr after execution of the following code: var myArr = [1,2,3,4,5]; myArr.shift();

Correct Answer : Option (B)

[2,3,4,5]
  Show Answer
10 .
What would be the result or type of error if p is not defined in the following JavaScript code snippet?
console.log(p)

Correct Answer : Option (C)

Reference Error
  Show Answer