Skip to content

Commit 4831fa6

Browse files
Added introductory README for JavaScript with key concepts
1 parent b10239a commit 4831fa6

2 files changed

Lines changed: 130 additions & 0 deletions

File tree

34.8 KB
Loading

Day 00 - Introduction/README.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# An Introduction to JavaScript
2+
3+
Let’s see what’s so special about JavaScript, what we can achieve with it, and what other technologies play well with it.
4+
5+
---
6+
7+
## What is JavaScript?
8+
9+
JavaScript was initially created to **“make web pages alive.”**
10+
11+
The programs in this language are called **scripts**. They can be written right in a web page’s HTML and run automatically as the page loads.
12+
13+
Scripts are provided and executed as plain text. They **don’t need special preparation or compilation** to run.
14+
15+
In this aspect, JavaScript is very different from another language called **Java**.
16+
17+
---
18+
19+
## Why is it called JavaScript?
20+
21+
When JavaScript was created, it initially had another name: **“LiveScript.”** But Java was very popular at that time, so it was decided that positioning a new language as a _“younger brother”_ of Java would help.
22+
23+
However, JavaScript became a fully independent language with its own specification called **ECMAScript**, and now it has no relation to Java at all.
24+
25+
Today, JavaScript can execute:
26+
27+
- In the **browser**
28+
- On the **server**
29+
- On **any device** with a JavaScript engine
30+
31+
### JavaScript Engines
32+
33+
Different browsers use different JavaScript engines:
34+
35+
- `V8` – in Chrome, Opera, and Edge
36+
- `SpiderMonkey` – in Firefox
37+
- Others: `Chakra` (IE), `JavaScriptCore`, `Nitro`, `SquirrelFish` (Safari)
38+
39+
These terms are useful to know because they’re often mentioned in developer articles.
40+
41+
---
42+
43+
## How do engines work?
44+
45+
JavaScript engines are complex, but here’s a simplified explanation:
46+
47+
1. The engine **parses** the script.
48+
2. It **compiles** it into machine code.
49+
3. The machine code is **executed**.
50+
51+
The engine also applies **optimizations** at every step. It even monitors how the code runs and dynamically improves performance as it executes.
52+
53+
---
54+
55+
## What can in-browser JavaScript do?
56+
57+
Modern in-browser JavaScript is a **safe** language. It doesn't give access to:
58+
59+
- Memory
60+
- The CPU
61+
62+
Instead, it can:
63+
64+
- Add or change HTML and CSS on the page
65+
- Respond to user interactions (clicks, key presses)
66+
- Send/receive requests (AJAX/COMET)
67+
- Work with cookies
68+
- Show alerts, confirmations, prompts
69+
- Store data locally (`localStorage`, `sessionStorage`)
70+
71+
---
72+
73+
## What CAN’T in-browser JavaScript do?
74+
75+
JavaScript in the browser has limitations for **security reasons**:
76+
77+
- Cannot read/write arbitrary files or access OS-level functions
78+
- File access is limited to user-initiated actions (e.g. selecting files)
79+
- Cannot access cameras/microphones without explicit permission
80+
- Cannot freely interact with other tabs/windows (due to **Same Origin Policy**)
81+
- Cannot send/receive data from another domain unless explicitly allowed (via CORS)
82+
83+
> Outside of the browser (e.g. in Node.js), many of these limitations do not apply.
84+
85+
![BrowserImageError](./BrowserError.png)
86+
87+
---
88+
89+
## What makes JavaScript unique?
90+
91+
JavaScript stands out because of:
92+
93+
1. **Full integration** with HTML/CSS
94+
2. **Simple things are simple** to do
95+
3. **Supported by all major browsers** by default
96+
97+
JavaScript is the only technology that brings these together, making it **the most widespread tool** for creating web interfaces.
98+
99+
It can also be used to:
100+
101+
- Build **servers**
102+
- Create **mobile apps**
103+
- Develop **desktop applications**
104+
105+
---
106+
107+
## Languages “over” JavaScript
108+
109+
Many developers want features not natively available in JavaScript. So several **transpiled languages** have emerged:
110+
111+
| Language | Highlights | Developed By |
112+
| ------------ | -------------------------------------------- | ------------ |
113+
| CoffeeScript | Cleaner, shorter syntax (loved by Ruby devs) ||
114+
| TypeScript | Strong typing for large-scale systems | Microsoft |
115+
| Flow | Static typing alternative | Facebook |
116+
| Dart | Can run in its own engine or transpile to JS | Google |
117+
| Brython | Allows writing browser code in Python ||
118+
| Kotlin | Concise, safe, targets browser or Node | JetBrains |
119+
120+
> Even if you use one of these, **knowing JavaScript is essential**.
121+
122+
---
123+
124+
## Summary
125+
126+
- JavaScript began as a **browser-only** language, but now runs in many environments.
127+
- It is the most **widely-adopted** browser scripting language.
128+
- There are many **transpiled languages**, but understanding JavaScript remains critical for web development.
129+
130+
---

0 commit comments

Comments
 (0)