TGViewer
Channel Public Channel
JavaScript

JavaScript

@javascript

A resourceful newsletter featuring the latest and most important news, articles, books and updates in the world of #javascript πŸš€ Don't miss our Quizzes!

Let's chat: @nairihar
Subscribers
31.1K
Photos
1.2K
Videos
10
Links
899

Showing posts older than #2355 Β· Back to latest

Older Posts 20 shown
Post #2354 5.11K
  • πŸ”₯ 3
  • ❀ 2
  • πŸ‘ 2
Post #2353 5.03K
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
Post #2352 5K
πŸ“Έ πŸ˜‰ 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)
  • πŸ”₯ 4
  • πŸ‘ 2
Post #2351 5.12K
  • πŸ‘ 10
Post #2350 4.82K
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
Post #2348 5.14K
  • πŸ”₯ 4
  • ❀ 3
  • πŸ‘ 1
Post #2347 4.89K
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');
Post #2346 5.67K
✌️ 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
  • ❀ 13
  • πŸ‘ 2
  • πŸ”₯ 1
Post #2345 4.67K
  • πŸ‘ 3
  • πŸ”₯ 2
  • ❀ 1
Post #2344 4.9K
CHALLENGE

const target = { a: 1, b: 2 };
const handler = {
get(obj, prop) {
return prop in obj ? obj[prop] * 2 : 'Not found';
}
};

const proxy = new Proxy(target, handler);

// Add property to original object
target.c = 3;

// Modify existing property directly on proxy
proxy.a = 10;

// Use Reflect.get instead of direct property access
const result = Reflect.get(proxy, 'd', { custom: true });

console.log(proxy.a, proxy.b, proxy.c, result);
  • ❀ 7
  • πŸ‘ 4
  • πŸ”₯ 1
Post #2343 4.56K
🀨 ANSIS 4.0: ANSI Color Library for Everywhere

A library to use the power of ANSI escape sequences for coloring and styling text in many environments including the terminal, Chromium-based browsers, Node, Bun, Deno, and even Next.js. v4.0 is a big upgrade with enough breaking changes to warrant a migration guide for existing users.

webdiscus
  • πŸ‘ 6
  • ❀ 1
  • πŸ”₯ 1
Post #2342 4.51K
  • ❀ 4
  • πŸ‘ 2
  • πŸ”₯ 1
Post #2341 4.81K
CHALLENGE

try {
const arr = [1, 2, 3];

function processArray() {
try {
nonExistentFunction();
} catch (err) {
throw new TypeError('Invalid type');
}
}

try {
processArray();
} catch (err) {
console.log(err instanceof Error, err instanceof TypeError, err.message);
}
} catch (finalError) {
console.log('Caught in outer block:', finalError);
}
Post #2340 4.59K
πŸ™ To continue delivering more exciting stories, we're kindly asking telegram premium users to help us (boost) take things to the next level.

We need 40 boosts 😭

https://t.me/javascript?boost
  • πŸ‘ 9
  • ❀ 3
  • πŸ”₯ 2
  • πŸ€” 2
Post #2339 4.83K
πŸ₯ƒ We often get feedback asking us to include answers to the quizzesβ€”but honestly, some of them need more explanation than a Marvel movie plot. It’s way better if you use Google or GPT to dig into the questions and uncover the answers like the true quiz detective you are!
  • πŸ‘ 13
  • 🀣 7
  • ❀ 3
  • πŸ”₯ 1
  • 🀩 1
Post #2338 4.79K
πŸ€” I Think the Ergonomics of Generators is Growing on Me

The author notes generator functions have been widely available in JavaScript for a long time, yet β€œtheir practicality hasn’t exactly caught on.” This is a great look at what they are and where they can be useful.

Alex MacArthur
  • ❀ 5
  • 🀣 2
  • πŸ”₯ 1
Post #2337 5.11K
  • πŸ€” 6
  • ❀ 3
  • πŸ‘ 2
  • πŸ”₯ 2
Post #2336 5.12K
CHALLENGE

const result = (function() {
let count = 0;

return {
increment() {
return ++count;
},
get value() {
return count;
},
reset() {
const oldCount = count;
count = 0;
return oldCount;
}
};
})();

result.increment();
result.increment();
console.log(result.reset() + result.value + result.increment());
  • πŸ‘ 1
Post #2335 4.84K
  • πŸ‘ 9
  • ❀ 2
  • πŸ”₯ 1
Older posts β†’
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook β†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 β†’