JavaScript: Variables

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

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.

document.GetElementByID("demo").innerHTML = x;

// The line above prints out "2".

let name = Barry;

document.GetElementByID("demo").innerHTML = name;

// The line above prints out "Barry".

</script>


</body>

</html> 



 

POSTREACT(ions) SUMMARY

Post Reply