What is the output ?? Var x=12;. Var y+=x;. Console.log (x) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the output ?? Var x=12;. Var y+=x;. Console.log (x)

please answer , I don't know the use of log.

27th Aug 2017, 8:17 AM
Shivam Dwivedi
Shivam Dwivedi - avatar
6 Answers
+ 4
the tag is plain wrong it should be JS, javascript, web not c++. please consider editing your question and adding relevant tags so you get better help and others don't get here by mistake while searching.
27th Aug 2017, 9:19 AM
Lord Krishna
Lord Krishna - avatar
+ 2
12, because console.log only prints the value to the console. y+=x adds the value of x to y, while x stays the same. there are multiple ways to print to console. info, log, error, warning to name a few. these are to help in debugging and filtering the console
27th Aug 2017, 8:21 AM
nitor
+ 2
I think your tag is wrong ... Edit : not the case anymore :) (tag was c++)
27th Aug 2017, 8:48 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
so basically it used for outputting the value
27th Aug 2017, 8:22 AM
Shivam Dwivedi
Shivam Dwivedi - avatar
0
thanks nitor
27th Aug 2017, 8:22 AM
Shivam Dwivedi
Shivam Dwivedi - avatar
0
yes that is correct
27th Aug 2017, 8:24 AM
nitor