Page 1 of 1

JavaScript: Variable Names

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

Code: Select all

<!DOCTYPE html>

<html>

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

<body>

<script>

// Variable names can start with an underscore, letter, or dollar sign.  They can contain the same and also numbers.

// Variable names are case sensitive.

// "let" variables cannot be redeclared in the same scope.  They cannot be accessed outside it's scope.

let _the_first_name = "Amber";

let $the_second_name = "Eddie";

let the_third_name = "Joleen";

let the_integer_after_2 = 3;

let the_fourth_name$ = "Melinda"';

// JavaScript variables declared with var have global scope.



</script>


</body>

</html>