This media is not supported in your browser
VIEW IN TELEGRAM
🔬Micro Frontends
If you are a big history fan and love daydreaming about the most effective war strategies, chances are you’re also a big fan of the war of the third coalition.
Why am I starting a blog with this? Well, one thing we all picked up from that war is one of the things that made Napoleon Bonaparte the best general in history (In my opinion) — SPEED!
If you are a big history fan and love daydreaming about the most effective war strategies, chances are you’re also a big fan of the war of the third coalition.
Why am I starting a blog with this? Well, one thing we all picked up from that war is one of the things that made Napoleon Bonaparte the best general in history (In my opinion) — SPEED!
❤8👍2
🚸 Inline conditionals in CSS?
Last week, we had a CSS WG face-to-face meeting in A Coruña, Spain. There is one resolution from that meeting that I’m particularly excited about: the consensus to add an inline if() to CSS. While I was not the first to propose an inline conditional syntax, I did try and scope down the various nonterminating discussions into an MVP that can actually be implemented quickly, discussed ideas with implemenators, and eventually published a concrete proposal and pushed for group resolution. Quite poetically, the relevant discussion occurred on my birthday, so in a way, I got if() as the most unique birthday present ever. 😀
Last week, we had a CSS WG face-to-face meeting in A Coruña, Spain. There is one resolution from that meeting that I’m particularly excited about: the consensus to add an inline if() to CSS. While I was not the first to propose an inline conditional syntax, I did try and scope down the various nonterminating discussions into an MVP that can actually be implemented quickly, discussed ideas with implemenators, and eventually published a concrete proposal and pushed for group resolution. Quite poetically, the relevant discussion occurred on my birthday, so in a way, I got if() as the most unique birthday present ever. 😀
🔥3❤2👍1
🚀 Are you ready to learn JavaScript from zero to Junior level?
I’ve prepared a series of articles to help you sharpen your skills and get ready for technical interview questions. Are you ready to start? Vote below! 👇
I’ve prepared a series of articles to help you sharpen your skills and get ready for technical interview questions. Are you ready to start? Vote below! 👇
Anonymous Poll
79%
I'm in!
8%
I'm not ready yet
13%
I'll wait for the course from Junior to Middle
❤11👍3
🚀 Kickstarting the "JavaScript from Zero to Junior" Course! 🚀
We’re launching our complete and in-depth JavaScript course! Today’s first topic: Variables and Data Types. You’ll learn:
✅ How to declare variables (var, let, const)
✅ All JavaScript data types
✅ Common pitfalls and tricky cases
✅ Interview questions you might encounter
📌 Read the first lesson and practice your skills!
We’re launching our complete and in-depth JavaScript course! Today’s first topic: Variables and Data Types. You’ll learn:
✅ How to declare variables (var, let, const)
✅ All JavaScript data types
✅ Common pitfalls and tricky cases
✅ Interview questions you might encounter
📌 Read the first lesson and practice your skills!
❤8👍4
Task 1: Correct the mistakes
The code below contains errors related to declaring and changing variables. Find and fix them.
✅ Write your version in the comments 📝
🔎 Look for a hint:
let age = 30; // Error: Re-advertisement
Use let instead of var. Now you can change the value without re-declaring the variable.
age = 30;
const pi; // Error
Сonst variable must be initialized. We need to declare and immediately initialize const:
const pi = 3.14;
console.log(typeof name === "null"); // Error
It is incorrect because typeof null returns "object" due to a bug in JS. You just need name === null.
#jsTasks
The code below contains errors related to declaring and changing variables. Find and fix them.
var age = 25;
let age = 30;
const pi;
pi = 3.14;
let name;
console.log(typeof name === "null");
✅ Write your version in the comments 📝
🔎 Look for a hint:
Use let instead of var. Now you can change the value without re-declaring the variable.
age = 30;
const pi; // Error
Сonst variable must be initialized. We need to declare and immediately initialize const:
const pi = 3.14;
console.log(typeof name === "null"); // Error
It is incorrect because typeof null returns "object" due to a bug in JS. You just need name === null.
#jsTasks
❤8🔥2👍1
Task 2: Determine the data type
What will be logged to the console in each case? Explain why.
✅ Write your version in the comments 📝
🔎 Look for a hint:
console.log(typeof "hello"); // "string"
console.log(typeof 42); // "number"
console.log(typeof true); // "boolean"
console.log(typeof null); // "object" (историческая ошибка в JS)
console.log(typeof undefined); // "undefined"
console.log(typeof {}); // "object"
console.log(typeof []); // "object" (массивы тоже объекты)
console.log(typeof function() {}); // "function" (фактически объект, но JS так определяет функции)
console.log(typeof NaN); // "number" (NaN – специальное значение типа number)
console.log(typeof 100n); // "bigint"
Explanation:
"typeof null" returns "object" due to a bug that has existed since early versions of JavaScript.
"typeof NaN" is "number" because NaN is an invalid numeric value.
"typeof []" is "object" because arrays in JavaScript are a type of object.
"typeof function() {}" is "function", but in reality, it is a subtype of an object.
What will be logged to the console in each case? Explain why.
console.log(typeof "hello");
console.log(typeof 42);
console.log(typeof true);
console.log(typeof null);
console.log(typeof undefined);
console.log(typeof {});
console.log(typeof []);
console.log(typeof function() {});
console.log(typeof NaN);
console.log(typeof 100n);
✅ Write your version in the comments 📝
🔎 Look for a hint:
console.log(typeof 42); // "number"
console.log(typeof true); // "boolean"
console.log(typeof null); // "object" (историческая ошибка в JS)
console.log(typeof undefined); // "undefined"
console.log(typeof {}); // "object"
console.log(typeof []); // "object" (массивы тоже объекты)
console.log(typeof function() {}); // "function" (фактически объект, но JS так определяет функции)
console.log(typeof NaN); // "number" (NaN – специальное значение типа number)
console.log(typeof 100n); // "bigint"
Explanation:
"typeof null" returns "object" due to a bug that has existed since early versions of JavaScript.
"typeof NaN" is "number" because NaN is an invalid numeric value.
"typeof []" is "object" because arrays in JavaScript are a type of object.
"typeof function() {}" is "function", but in reality, it is a subtype of an object.
👍11❤1🔥1
Task 3: Type casting
What will be printed to the console? Explain why.
✅ Write your version in the comments 📝
🔎 Look for a hint:
1. "53" (concatenation, since "5" is a string)
2. "2" (the string "5" is converted to a number)
3. "6" (true is converted to 1)
4. "20" (both values are converted to numbers)
5. "NaN" (you can't subtract a number from a string of letters)
6. "5" (null is converted to 0)
7. "NaN" (undefined can't be a number)
8. "true" (a non-empty string is truthy)
9. "false" (0 is falsy)
10. "true" (an array is a truthy value)
Explanation:
JS automatically converts strings and numbers in arithmetic operations.
null becomes 0, undefined becomes NaN.
!! is a double logical negation that turns a value into true or false.
What will be printed to the console? Explain why.
console.log("5" + 3);
console.log("5" - 3);
console.log(5 + true);
console.log("10" * "2");
console.log("10px" - 2);
console.log(null + 5);
console.log(undefined + 5);
console.log(!!"false");
console.log(!!0);
console.log(Boolean([])); ✅ Write your version in the comments 📝
🔎 Look for a hint:
2. "2" (the string "5" is converted to a number)
3. "6" (true is converted to 1)
4. "20" (both values are converted to numbers)
5. "NaN" (you can't subtract a number from a string of letters)
6. "5" (null is converted to 0)
7. "NaN" (undefined can't be a number)
8. "true" (a non-empty string is truthy)
9. "false" (0 is falsy)
10. "true" (an array is a truthy value)
Explanation:
JS automatically converts strings and numbers in arithmetic operations.
null becomes 0, undefined becomes NaN.
!! is a double logical negation that turns a value into true or false.
👍7❤4
Сhoose the correct option
Anonymous Quiz
55%
"53", 2, 6, 20, NaN, 5, NaN, true, false, true
33%
"53", 2, 5, 102, NaN, 5, undefined , true, false, false
12%
8, 2, 6, 20, NaN, 5, undefined , true, true, true
Task 4: Using let, const, var
What will be the result of running the code? Why?
✅ Сhoose the correct option 📝
🔎 Look for a hint:
1. undefined (due to hoisting, variable is declared but not yet initialized)
2. Error! Variable is declared but is in the "dead zone" (TDZ)
3. 50 (var variable is accessible outside the block)
4. Error! y is only defined in the if block
Explanation:
var is hoisted but not initialized, so console.log(a); prints undefined.
let and const are not hoisted, so console.log(b); throws an error.
var is not block scoped, so x is accessible outside the block.
let is scoped to {} and y is not accessible outside the if block.
What will be the result of running the code? Why?
console.log(a);
var a = 10;
console.log(b);
let b = 20;
if (true) {
var x = 50;
}
console.log(x);
if (true) {
let y = 60;
}
console.log(y);
✅ Сhoose the correct option 📝
🔎 Look for a hint:
2. Error! Variable is declared but is in the "dead zone" (TDZ)
3. 50 (var variable is accessible outside the block)
4. Error! y is only defined in the if block
Explanation:
var is hoisted but not initialized, so console.log(a); prints undefined.
let and const are not hoisted, so console.log(b); throws an error.
var is not block scoped, so x is accessible outside the block.
let is scoped to {} and y is not accessible outside the if block.
👍6🔥6
Сhoose the correct option
Anonymous Quiz
22%
10, 20, 50, Error
51%
undefined, Error, 50, Error
27%
10, Error, 50, 60
Task 5: Determine the result of the code
What will be the result of executing the following code? Why?|
✅ Сhoose the correct option 📝
🔎 Look for a hint:
1. 2 (bar and foo point to the same object)
2. [1, 2, 3, 4] (a and b point to the same array)
3. "hello" (strings are primitives, passed by value)
Explanation:
Objects and arrays are passed by reference, so bar.n changes foo.n, and b.push(4) changes a.
Primitive types (string, number, boolean) are passed by value, so changing y does not affect x.
What will be the result of executing the following code? Why?|
let foo = { n: 1 };
let bar = foo;
bar.n = 2;
console.log(foo.n);
let a = [1, 2, 3];
let b = a;
b.push(4);
console.log(a);
let x = "hello";
let y = x;
y = "world";
console.log(x);✅ Сhoose the correct option 📝
🔎 Look for a hint:
2. [1, 2, 3, 4] (a and b point to the same array)
3. "hello" (strings are primitives, passed by value)
Explanation:
Objects and arrays are passed by reference, so bar.n changes foo.n, and b.push(4) changes a.
Primitive types (string, number, boolean) are passed by value, so changing y does not affect x.
❤6🔥1
✅ Сhoose the correct option 📝
Anonymous Quiz
41%
2, [1, 2, 3, 4], "hello"
37%
1, [1, 2, 3], "hello"
23%
2, [1, 2, 3, 4], "world"
🔎 CSS content-visibility: The Web Performance Boost You Might Be Missing
The content-visibility CSS property delays rendering an element, including layout and painting, until it is needed
Web performance optimization can be a real headache. Shaving off milliseconds here and there, minifying everything in sight, and praying to the performance gods.
The content-visibility CSS property delays rendering an element, including layout and painting, until it is needed
Web performance optimization can be a real headache. Shaving off milliseconds here and there, minifying everything in sight, and praying to the performance gods.
❤6👍2🔥1
⏰ Master JavaScript date and time: From Moment.js to Temporal
JavaScript’s Date API has long been a source of frustration for developers due to its historical design flaws, including its:
- Unreliable parsing behavior
- Mutable nature
- Weak time zone support
To overcome these issues and limitations, developers have turned to libraries like Moment.js for more reliable and feature-rich date and time handling. Now, JavaScript has a new built-in solution on the horizon: the Temporal API, which brings a modern and intuitive approach to date and time manipulation.
In this article, we’ll examine JavaScript’s Date API limitations, discussing the strengths and weaknesses of popular libraries like Moment.js, and delving into the Temporal API.
JavaScript’s Date API has long been a source of frustration for developers due to its historical design flaws, including its:
- Unreliable parsing behavior
- Mutable nature
- Weak time zone support
To overcome these issues and limitations, developers have turned to libraries like Moment.js for more reliable and feature-rich date and time handling. Now, JavaScript has a new built-in solution on the horizon: the Temporal API, which brings a modern and intuitive approach to date and time manipulation.
In this article, we’ll examine JavaScript’s Date API limitations, discussing the strengths and weaknesses of popular libraries like Moment.js, and delving into the Temporal API.
👍7❤2