Mark (@software_mark_) profile picture

Everything software engineering

Joined November 2025
3/ Proof #3 — Hoisting & the Temporal Dead Zone
2
1
10
2/ Proof #2 — Early Errors Strict mode is only inside the function — yet nothing prints at all. Not even "Howdy." JS caught the duplicate parameter error before a single line ran. 🤯 #YDKJS #365DaysOfYDKJS #JavaScript
1
1
34
1/ Proof #1 — Syntax Errors The console.log never runs — even though it appears before the error. If JS executed line by line, it would have logged first. It didn't. Parsing happened before execution. 🧠 #YDKJS #365DaysOfYDKJS #JavaScript
1
2
39
Starting Book 2 of the YDKJ series.
1
3
29
6/ Closures are critical in async programming too: getSomeData finishes almost immediately — but onResponse closes over url and it's always available whenever the ajax call completes. ⚡ #YDKJS #365DaysOfYDKJS #JavaScript
1
2
69
5/ Each closure instance is independent: incBy1 and incBy3 each have their own closed-over count and step. They don't share state. 🔒 #YDKJS #365DaysOfYDKJS #JavaScript
1
1
19
4/ Closures don't just take a snapshot of a value. They maintain a live reference to it — meaning if the value changes, the closure always has the most updated version: #YDKJS #365DaysOfYDKJS #JavaScript
1
1
17
3/ Here's a basic example: who closes over msg — remembering it every time it's called. ✅ #YDKJS #365DaysOfYDKJS #JavaScript
1
1
12
In a factory module, data is private by default. In a class, everything is public by default.
2
22
Before ES6, JavaScript developers were already building modules manually. Just a function. Returning an object. Hiding data in closure scope. Simple pattern. Powerful results. 💡 #JavaScript #YDKJS #365DaysOfYDKJS
4
122
4/ Here's the same example as a Class vs a Factory Module:
1
1
4
3. Now a Book class that extends it: super() calls the parent constructor. super.print() calls the parent method. ✅#YDKJS #365DaysOfYDKJS #JavaScript
1
1
56
2. Here's a practical example: A base class with shared data and behaviour. 📌 #YDKJS #365DaysOfYDKJS #JavaScript
1
1
92
BS, using the traditional method(An ascendingly sorted array). BS, by recursion coming up next.
2
19