+ 6

Please explain y+= ++x + "" + x;

; lets take x= 6; y=0; n put your individual answer.

5th Mar 2017, 6:23 PM
Ankur Soni
Ankur Soni - avatar
5 odpowiedzi
+ 4
what i think is... y= 77. is this correct? yes, then explain please
5th Mar 2017, 6:31 PM
Ankur Soni
Ankur Soni - avatar
+ 3
Dear ,actually in the programming languages where this is must to declare the data type (in Java ,C,C++etc) before use ,then it will give an error. Other wise (in Java script) it will be typecasted in String , so in that case answer will be 077.
5th Mar 2017, 7:11 PM
Chetan Sharma
Chetan Sharma - avatar
+ 2
077 I would say, because you add an empty string, which change the type of your variable.
5th Mar 2017, 6:36 PM
Geoffrey L
Geoffrey L - avatar
+ 1
Hope I'm not answering bullshit but in my mind it should be: y+ -> take actual value of y and add the following ++x -> it gets the actual value of x and increment it immediatly with 1 + "" + -> add an empty string + x -> + x
5th Mar 2017, 6:27 PM
Geoffrey L
Geoffrey L - avatar
+ 1
Yes that's it, I just try. => http://codepen.io/anon/pen/EWyMoJ
5th Mar 2017, 6:39 PM
Geoffrey L
Geoffrey L - avatar