Introduction to JavaScript – Getting
Started with Basics
What is JavaScript?
• Dynamic programming language
• Used in web development
• Runs in browser
JavaScript in Action (Example)
• HTML snippet with onclick buttons
• Functions: showMessage() and
changeBackgroundColor()
Key JavaScript Elements
• let, const, or var – variable declaration
• Functions & DOM manipulation
Welcome Alert & Button Demo
• alert("Welcome!") on load
• Changing text with innerText
Color Changing Example
• Random background color change
• Use of arrays and [Link]()
JavaScript vs Python – Numbers
Concept JavaScript Python
Variable Declaration let x = 5 x=5
Division 5 / 2 = 2.5 5 / 2 = 2.5 and //
Power x ** y, [Link] x ** y
Square Root [Link](9) [Link](9)
Common Number Functions
• [Link](), [Link](), [Link]()
• Example outputs from JS
Infinity & NaN
• 1 / 0 = Infinity
• "abc" * 2 = NaN
Summary
• JavaScript basics, syntax, and number
operations
• Comparison with Python