JavaScript is a programming language mainly used to make websites interactive.
- Respond to user actions (clicks, typing)
- Update content without reloading the page
- Create animations, games, and dynamic effects
- Communicate with servers (fetch data)
3 Places to put JavaScript code
- Between the head tag of html
- Between the body tag of html
- In .js file (external javaScript)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>JavaScript</title>
<script>
document.write("Hello from Yahoo Baba");
</script>
</head>
<body>
<h1>Hello</h1>
</body>
</html>