Clean β’ Professional
JavaScript is a high-level, interpreted programming language that allows you to make web pages interactive and dynamic. Alongside HTML and CSS, it is one of the core technologies of web development.
Latest versions (ES6 and beyond) introduced features like let, const, arrow functions, promises, and classes β making JavaScript more powerful and modern.
JavaScript is used everywhere β from simple web pages to large-scale applications.
Hereβs what you can do with it:
Example:
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<h1 id="greeting">Hello!</h1>
<button onclick="changeText()">Click Me</button>
<script>
// JavaScript function to change text dynamically
function changeText() {
document.getElementById('greeting').innerText = "Hello, JavaScript!";
}
</script>
</body>
</html>Explanation:
onclick="changeText()" β Executes the function when the button is clicked.document.getElementById() β Selects an HTML element by ID..innerText β Changes the visible text of the element.When you click the button, the heading updates from βHello!β to βHello, JavaScript!β β no page reload needed.