For the last question.. Can someone explain how a became 2 ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

For the last question.. Can someone explain how a became 2 ?

24th Feb 2017, 11:37 PM
Santhosh Ashokkumar
3 Answers
0
Please explain question properly.
25th Feb 2017, 12:06 PM
Prasanna VB
0
First, var a is declared and initialized to be 0. a is now equal to 0. Second, a is initialized to be 1, because 1 is counted up to a before the rest of the line will be executed. Third, let b is declared and initialized to be a, which is now 1. a is now equal to 1. b is now equal to 1. Fourth, let c is declared and initialized to be a, which is now 1, because a is set to be the value of c before the rest of the line will be executed. Fifth, a is initialized to be 2, because 1 is counted up to a. a is now equal to 2. b = now equal to 1. c = now equal to 1. Understood?
7th May 2017, 2:26 PM
Gert-Jan Schaap
Gert-Jan Schaap - avatar
0
Got it. Thanks
18th Jun 2017, 1:00 AM
Santhosh Ashokkumar