JavaScript: A Basic Example

Post Reply
User avatar
The Jason
Site Admin
Posts: 888
Joined: Tue Jul 01, 2025 10:13 am
Contact:

Code: Select all

<!DOCTYPE html>

<html>

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

<body>

<script>

let x = 2;

// The line above represents the declaration of a variable with the integer value of 2.

// The integer data type, as with other ones, is not declared.

window.alert("1 + 1 is" + x + ".");

// The line above outputs "1 + 1 is 2." on window.

</script>


</body>

</html> 


 

POSTREACT(ions) SUMMARY

Post Reply