What is the use of console in js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is the use of console in js

What is the use of console found in every web browser and what is the of console.log command in JS?

30th Aug 2018, 11:22 AM
Nibir Paran Barman
Nibir Paran Barman - avatar
4 Answers
+ 3
As Charlie said, it's used mostly for debugging purposes. Imagine you have a function that it's not behaving as expected because it's not receiving the expected parameter's values, what you do is you print to the console the variables used as parameters to confirm the values, and then you just press "F12" in your favorite browser and look for the console output, in there you will find the result. Please consider that no matter how good your IDE is on regard of debugging, nothing will replace the most simple and reliable technique, which is printing the variables and the function returns to the console for confirmation. Good luck to you.
30th Aug 2018, 12:10 PM
Roberto Guisarre
Roberto Guisarre - avatar
+ 2
console is used to test your javascript code
30th Aug 2018, 11:26 AM
Charlie Da stiles
Charlie Da stiles - avatar
31st Aug 2018, 6:33 AM
Alan Carreño Fiestas
Alan Carreño Fiestas - avatar
+ 1
Thanks Charlie Da stiles and Roberto Guisarre for helping me. I am totally new at field of programming
30th Aug 2018, 12:13 PM
Nibir Paran Barman
Nibir Paran Barman - avatar