Telegram Web Link
πŸ‘3πŸ”₯2❀1
✌️ A Brief History of JavaScript

JavaScript (originally named LiveScript) turns thirty years old this year and the Deno team has put together a fantastic timeline-based tour of how much things have progressed from its first appearance in Netscape Navigator, through offshoots like JScript, standardization, and the introduction of Node.js, all the way through to the modern day.

The Deno Team
Please open Telegram to view this post
VIEW IN TELEGRAM
❀12πŸ‘2πŸ”₯1
CHALLENGE

function analyze(...items) {
const [first, ...rest] = items;
const { length } = [...rest, 'bonus'];
const result = {
...first,
count: length,
};

console.log(result);
}

analyze({ id: 42, name: 'Item' }, 'a', 'b');
❀5πŸ‘1🀩1
CHALLENGE

const user = { id: 1, name: 'Alice' };
const userData = new WeakMap();

userData.set(user, { lastLogin: '2023-01-01' });
const clone = { ...user };

const originalData = userData.get(user);
const cloneData = userData.get(clone);

console.log(originalData, cloneData);
❀1πŸ‘1
πŸ“Έ πŸ˜‰ What's New in Angular

Two members of the Angular team presented a session at this week’s Google I/O event on the latest updates to the Angular framework in anticipation of the eventual release of Angular 20 next Thursday.

Chasanoff and Thompson (Google)
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯4πŸ‘2
CHALLENGE

function mystery() {
try {
throw new Error('Oops');
return 'A';
} catch (err) {
return 'B';
} finally {
return 'C';
}
}

function wrapper() {
try {
return mystery();
} finally {
console.log('D');
}
}

console.log(wrapper());
πŸ‘7
What is the output?
Anonymous Quiz
32%
C D
37%
B D C
20%
D C
10%
D B
πŸ”₯3❀2πŸ‘2
CHALLENGE

function compose(...funcs) {
return function(x) {
return funcs.reduceRight((acc, fn) => fn(acc), x);
};
}

const add10 = x => x + 10;
const multiply2 = x => x * 2;
const toString = x => `Result: ${x}`;

const composed = compose(toString, multiply2, add10);
console.log(composed(5));
πŸ‘6❀1
πŸ‘7πŸ€”4❀2πŸ”₯2
CHALLENGE

try {
try {
// Creating a custom error type
class CustomError extends Error {
constructor(message) {
super(message);
this.name = "CustomError";
}
}

const fn = () => {
throw new CustomError("Something went wrong");
};

try {
fn();
} catch (e) {
throw new TypeError("Type error occurred");
}
} catch (e) {
console.log(e instanceof Error, e.name, e instanceof TypeError);
}
} catch (e) {
console.log("Outer catch", e.message);
}
❀5πŸ‘2πŸ”₯1
❀3πŸ‘3πŸ”₯2
CHALLENGE

function* counter() {
let i = 1;
while (true) {
const reset = yield i++;
if (reset) {
i = 1;
}
}
}

const gen = counter();
console.log(gen.next().value);
console.log(gen.next().value);
console.log(gen.next(true).value);
console.log(gen.next().value);
❀2
πŸ‘8❀2
CHALLENGE

const users = [
{ id: 1, name: 'Alice' },
{ id: 2, name: 'Bob' },
{ id: 3, name: 'Charlie' }
];

const userScores = new WeakMap();

// Set scores for users
userScores.set(users[0], 95);
userScores.set(users[1], 80);

// Remove reference to Bob
users[1] = null;

let sum = 0;
for (const user of users) {
if (user && userScores.has(user)) {
sum += userScores.get(user);
}
}

console.log(sum);
πŸ‘7❀2
❀4πŸ”₯1
😭 Matteo Collina has unveiled php-node, a way to run PHP apps within the same process as Node.js. Run WordPress with a Next.js frontend? Sure.
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ€”11🀣8πŸ‘4
CHALLENGE

class ShoppingCart {
constructor() {
if (ShoppingCart.instance) {
return ShoppingCart.instance;
}

this.items = [];
ShoppingCart.instance = this;
}

addItem(item) {
this.items.push(item);
}

getItems() {
return [...this.items];
}
}

const cart1 = new ShoppingCart();
const cart2 = new ShoppingCart();

cart1.addItem('Book');
cart2.addItem('Laptop');

console.log(cart1.getItems());
❀3
2025/07/12 01:22:52
Back to Top
HTML Embed Code: