Interactive Web Development
What is JS? JavaScript is a cross-platform, object-oriented scripting language used to make webpages interactive (e.g., having complex animations, clickable buttons, popup menus, etc.).
JS files are placed in <script>
tag in html, and by default the display
property of script is none
Create an HTML file: Create a new HTML file using a text editor.
Internal JS
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
alert("Hello, World!");
</script>
</body>
</html>
External JS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
Open in a Web Browser: Save the HTML file and open it in a web browser.
View Console Output: Open the browser's developer tools (by right-clicking on the page, selecting "Inspect," and navigating to the "Console" tab) to view console output and errors.
cout<<”Hello World”;
→ console.log(’Hello World’)
Ctrl+Shift+i
)<aside> 💡 ECMAScript === JavaScript
</aside>