console.log

Use console.log to provide diagnostic capabilities for debugging.

 

console.log("Hello, world!") ; //will print Hello, World! in the console

 

Other parameters can be passed in, such as document.cookies to show what cookies are currently used by the document, or passing a variable that has been assigned getElementsById:

 

var = myVar.getElementsBtId("p") ;

console.log(myVar) ;

 

This will return an array of all the p elements, that can further be drilled down into within the console.

 

Once in the console, you can use JavaScript as per your scripts, e.g. to make all text blue:

 

document.body.style.color = "blue"

Leave a Reply