UMME NAFISA ANZUM KOTHA
ID-2154901047
JavaScript, created in 1995 and renamed from LiveScript.
high-level interpreted language
mainly used in web browsers for client-side interactivity
why to use JavaScript-
Interactivity – JavaScript makes web pages dynamic (e.g., buttons, forms, animations)
DOM Manipulation – Allows real-time updates to HTML/CSS without reloading the page.
Client-Side Execution – Runs in the browser, reducing server load and
improving speed.
PlACEMENT OF JAVASCRIPT CODE
EMBEDDED JAVASCRIPT EXTERNAL JAVASCRIPT
<html>
<head>
<script>
alert(“Good Morning!"); /[Link] /
</script> [Link](‘welcome to the class!’);
</head>
<body>
<h1>JavaScript in Body</h1>
<script> External scripts help keep code clean and
alert("Hello, JavaScript!"); reusable
</script>
<p>
<script src=“[Link]”></script>
</p>
</body>
</html>
JavaScript Keywords
Variables store data that can be reused or updated later.
The let keyword is block-scoped, allows reassignment, but cannot be redeclared
in the same scope.
The const keyword is block-scoped, cannot be reassigned or redeclared, and must be initialized
during declaration.
Primitive datatypes represent single values
Non-primitive types are objects and can store
collections of data or more complex entities.
JAVASCRIPT DEMO
<body>
<h1 id="info">Welcome!</h1>
<p id="para">Click the button to interact with JavaScript!</p>
<button id="click" onclick="updateContent()">Click Me</button>
<script src="[Link]"></script>
</body>
/Javascript code/
function updateContent() {
const header=[Link]('info’);
header. innerHTML = ‘<h2>🎉 Presentation Started!</h2>';
const para= [Link]('para’);
[Link] = 'JavaScript updated this text’;
[Link]("Button clicked using onclick attribute.");
}
THANK YOU!