Photo by Gabriel Heinzer on Unsplash
2 min read
You can write anything to the web console by passing it as a string. For example,
In addition to strings, you can log variables to inspect their values in the web console. Referring to our sum example, we can inspect the values of individual variables or all the variables.
It will print 10 for a and 20 30 for b and sum.
You can log strings and variables together in the web console.
While working with APIs, you may need to inspect the value of any object returned in a JSON response. You can log it to the web console.
4. HTML elements
You can log any html element in the web console to inspect its values.
The output in the web console would be