What is JavaScript? Client vs Server, History, Examples
What is a Programming Language?
Just like humans need a language (Hindi, English) to communicate,
Computers also need a language called a Programming Language.
Examples:
- Java
- PHP
- Python
- JavaScript
Where JavaScript is Used
Mainly used for:
- Websites
- Web applications
Server vs Browser Execution
Server-Side Languages
- Examples:
- Java
- PHP
- Python
- C, C++
These languages:
- Run on the server
- Send output to the browser
Called Server-side scripting
JavaScript (Client-Side Language)
JavaScript:
- Code is sent to the browser
- Executes inside the browser
Called Client-side scripting
How Websites Work (Basic Idea)
Code is uploaded on a server
Users access it through a browser
Each website has a unique domain name
- Example:
- google.com
- youtube.com
- facebook.com
What JavaScript Can Do
- Show alerts (messages)
- Change text
- Change colors
- Perform actions instantly in the browser
- Create interactive and dynamic UI
Why Not Use Only JavaScript?
JavaScript has limitations.
Cannot do:
Database connectivity
Server-side file creation or modification
Can do:
UI changes (text, color, animations)
Display data
Handle browser-side actions
When Other Languages Are Used
For server-related tasks:
- PHP
- Python
- Java
Advanced Possibilities
JavaScript can also:
- Run on servers
- Build mobile apps
- Create software
- (Details will be covered later in the course)
Setup Requirement
No installation needed
Only a browser is required:
- Chrome
- Firefox
JavaScript History
First released in 1995
Created in just 10 days
Earlier names:
- Mocha
- LiveScript
- Then JavaScript
Initially had issues, improved over time
Still receives updates and new features
Conclusion
JavaScript can be used to build:
- Websites
- Mobile apps
- Software
It is an evergreen language
Its usage is continuously growing