Coding exercise to test your learning of mutation and assignment.
Task
Due to unforeseen circumstances, some values of variables have been shifted into one another. Your task: to fix this using your newly acquired knowledge of variable mutation.
Problem statement
You are given three variables named var1
, var2
and var3
. Write code such that the following is satisfied:
var1
contains the value ofvar2
var2
contains the value ofvar3
var3
contains the value ofvar1
The above diagram illustrates this perfectly. Keeping the above problem in mind, complete the following code. Whenever you feel that you have done it, hit TEST. Good luck!
Code now
// update the code below such that the final values of// the variables are as follows// var1 contains the value of var2// var2 contains the value of var3// var 3 contains the value of var1var1=var1;var2=var2;var3=var3;
NOTE: You can always call in
console.log()
for debugging purposes. All the print statements fromconsole.log()
are in the “Show Console” tab after hitting TEST.