<script> tags.
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script>
console.log("Hello, JavaScript!");
</script>
</body>
</html>
let, const, and var to declare variables.
let name = "JavaScript";
const year = 1995;
console.log(name + " was created in " + year);
if, else, and else if statements.for, while, and do while.
let age = 18;
if (age >= 18) {
console.log("You are an adult.");
} else {
console.log("You are a minor.");
}
function greet(name) {
return "Hello, " + name + "!";
}
console.log(greet("Alice"));
document.getElementById("myButton").onclick = function() {
alert("Button clicked!");
};