Page 1 of 1

JavaScript: Written Output and Comments

Posted: Sun Aug 03, 2025 10:12 am
by The Jason

Code: Select all

<!DOCTYPE html>

<html>

<head><title>JavaScript Examples</title></head>

<body>

<script>

// This is a single line comment.

/*  This is a multi-line comment.
Here is the 2nd line */

window.alert("The forum is called Hosting Chatter..");

// The line outputs "The forum is called Hosting Chatter" (no parentheses) on window.

let month = "January";

// Below is string interpolation so you don't have to worry about spacing and putting in variables as much.

window.alert("${month} is considered a cold month in the temperate nations of the Northern Hemisphere.")

// outputs "January is considered a cold month in the temperate nations of the Northern Hemisphere." (no parenthesis) on window.

</script>


</body>

</html>