Observe the following JavaScript array declaration and answer the question:…
2017
Observe the following JavaScript array declaration and answer the question: Statement 1 ItemName = new Array ( "Chromebook" , "IPad" , "Mobile" ); Statement 2 ItemName = [ "Chromebook" , "IPad" , "Mobile" ]; ----------------------------------------
- A.
Both statements have exactly the same effect.
- B.
Both statements are different as they declare different types of variables.
- C.
Both statements are different as one is only declaring while other is declaring and initializing.
- D.
Both statements are different as they declare arrays of different sizes.
Attempted by 366 students.
Show answer & explanation
Correct answer: A
Correct Answer: A. Both statements have exactly the same effect. ----------------------------------------
A video solution is available for this question — log in and enroll to watch it.