print var javascript code example

Example 1: how to print a line in javascript

console.log("Your line would be here")//Prints a line on the console 
alert("Your message here")//Raises an alert

Example 2: html console text

<script>
  console.log('%c text', 'background:---; color:---; font-size:---;');
</script>

Example 3: js outputting data

Javascript: Outputting Data
alert()
Output data in an alert box in the browser window
confirm()
Opens up a yes/no dialog and returns true/false depending on user click
console.log()
Writes information to the browser console, good for debugging purposes
WebsiteSetup.org - Beginner’s Javascript Cheat Sheet 5
document.write()
Write directly to the HTML document
prompt()
Creates an dialogue for user input