Examveda
Examveda

Consider the following code snippet
[x,y]=[y,x];
What is the result of the above code snippet?

A. Throws exception

B. Swap the value of the two variables

C. Flashes an error

D. Creates a new reference object

Answer: Option C

Solution(By Examveda Team)

The above code snippet swaps the value of the two variables.

Join The Discussion

Related Questions on Classes and Modules

The let keyword can be used

A. in a for or for/in loop, as a substitute for var

B. as a block statement, to define new variables

C. to define variables that are scoped to a single expression

D. all of the mentioned