volume_mute

Way of assigning values JavaScript variables

publish date2022/09/05 01:24:00 GMT+10

volume_mute

It is possible in JavaScript to write two consecutive assignment statements like that

list = [10.2, 3.5];

list = 47;

 

True
False

Correct Answer

True

Explanation

A JavaScript script may contain the following statement:

list = [10.2, 3.5];

Regardless of the previous type of the variable named list, this assignment causes it to become the name of a single-dimensioned array of length 2. If the statement

list = 47;

followed the previous example assignment, list would become the name of a scalar variable.

Reference

Concepts of Programming languages, 10th ed


Quizzes you can take where this question appears