Code: Select all
<!DOCTYPE html>
<!-- basic-javascript-example.htm -->
<head><title>Basic JavaScript Example</title></head>
<body>
<script lang = "Javascript">
/* Alternately with modification, this script could be saved as basic-javascript-example.js or the whole page saved as basic-javascript-example.php, if php code also present */
age = 35;
$name = "Jerry";
_school_name = "University of North Carolina";
major_at_school$ = "Physics";
class_at_2_pm_Monday = "Weather Science";
window.alert("${$name} attends ${_school_name} and his major is ${major_at_school} and his class at 2 pm Monday is ${class_at_2_pm_Monday}.");
window.alert($name + " " + "attends + " " + _school_name + " " + "and his major is" + " " + major_at_school + " " + "and his class at 2 pm Monday is" + " " + class_at_2_pm_Monday + ".");
// Nice JavaScript Review
/* Yes
that's right. */
</script>
</body>
</html>
