Notes
JavaScript can "display" data in different ways:
innerHTML:
To access an HTML element, JavaScript can use the document.getElementById(id) method.
The id attribute defines the HTML element. The innerHTML property defines the HTML content:
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML ='JavaScript for Salesforce;
</script>
OUTPUT:
JavaScript for Salesforce
document.write():
<script>
document.write(2 + 3);
</script>
OUTPUT:
5
alert():
You can use an alert box to display data:
<script>
alert(2 + 3);
</script>
window.alert():
For debugging purposes, you can call the console.log() method in the browser to display data.
<script>
console.log(2 + 3);
</script>