Chapter 00
JavaScript Introduction
JavaScript is a programming language used to make websites interactive, dynamic, and responsive to user actions.
01 • Learn
What is JavaScript Introduction?
- JavaScript is one of the most popular programming languages for web development.
- HTML creates the structure of a webpage, CSS controls its design, and JavaScript adds behavior and interaction.
- JavaScript can run directly in a web browser.
- JavaScript is used for forms, buttons, menus, sliders, calculators, games, APIs, and web applications.
02 • Syntax
Syntax
let message = 'Hello AIFA'; console.log(message);
03 • Example
Example
Try understanding this code before running it.
<!DOCTYPE html>
<html>
<body>
<h2>AIFA Coding Lab</h2>
<button onclick="showMessage()">Click Me</button>
<script>
function showMessage() {
alert('Welcome to JavaScript!');
}
</script>
</body>
</html>
04 • Remember
Important Points
- JavaScript can be written inside the <script> tag in an HTML page.
- Using semicolons at the end of statements is a good coding practice.
- JavaScript is case-sensitive.
- The browser Developer Console is useful for checking output and errors.
05 • Avoid
Common Mistakes
- Confusing JavaScript with Java. They are different programming languages.
- Ignoring uppercase and lowercase differences.
- Closing the <script> tag incorrectly.
06 • Practical
Real-World Use
Login forms, shopping websites, online calculators, dashboards, animations, games, and modern web applications use JavaScript.
07 • Practice
Practice Exercise
Practice: First JavaScript Program
Create an HTML page with a button. When the button is clicked, display 'Welcome to AIFA' in an alert box.
Ready to write code?
Open the JavaScript editor and run your code with live output.