xxxxxxxxxx
//print in the window
document.write("Have a nice day!");
//print in the console log (Right click->Inspect ->Console)
console.log("Have a nice day!");
xxxxxxxxxx
console.log("Text");
var randomText = "randomText";
console.log(randomText);
console.err("Error: U Looked at this comment");
//Logs an error.
xxxxxxxxxx
function printpage(){
var originalContents = document.body.innerHTML;
var printReport= document.getElementById('div1').innerHTML;
document.body.innerHTML = printReport;
window.print();
document.body.innerHTML = originalContents;
}
xxxxxxxxxx
//print in the window
document.write("I need a girlfriend");
//print in the console log (Right click->Inspect ->Console)
console.log("I need a girlfriend");