What is the observation made in the following JavaScript code? [code] var count = [1,,3]; [/code]

What is the observation made in the following JavaScript code?
Code:
var count = [1,,3];
A. The omitted value takes “undefined”
B. This results in an error
C. This results in an exception
D. The omitted value takes an integer value
 
Answer: a
Explanation: Array is defined with a null value when no value is mentioned. If you omit a value from an array literal, the omitted element is given an undefined value.
 

Tìm kiếm

Back
Top