What is the output?
Anonymous Quiz
21%
Transaction processed
35%
RangeError: Amount must be positive
23%
{ status: 'Type Error', message: 'Amount must be a number' }
21%
{ status: 'Range Error', message: 'Amount must be positive' }
π10β€2π₯1π€©1
CHALLENGE
function modify(obj) {
obj.a.push(4);
obj.b = 'changed';
return obj;
}
const original = { a: [1, 2, 3], b: 'original', c: { deep: true } };
const copy1 = { ...original };
const copy2 = JSON.parse(JSON.stringify(original));
modify(copy1);
console.log(original.a, original.b, copy2.c === original.c);
π5β€1π€©1
What is the output?
Anonymous Quiz
27%
[1, 2, 3] 'original' true
29%
[1, 2, 3] 'original' false
23%
[1, 2, 3, 4] 'original' false
21%
[1, 2, 3, 4] 'changed' false
π9β€2π₯1
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
π€6β€3π2π₯2
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
Please open Telegram to view this post
VIEW IN TELEGRAM
β€5π€£2π₯1
Media is too big
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
π13π€£7β€3π₯1π€©1
We need 40 boosts
https://t.me/javascript?boost
Please open Telegram to view this post
VIEW IN TELEGRAM
1π9β€3π₯2π€2
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);
}
What is the output?
Anonymous Quiz
29%
true true Invalid type
37%
true false 'nonExistentFunction is not defined'
20%
true true 'Invalid type'
13%
false true 'Invalid type'
β€4π2π₯1
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
Please open Telegram to view this post
VIEW IN TELEGRAM
π5β€1π₯1
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
What is the output?
Anonymous Quiz
26%
10 4 6 Not found
29%
10 4 3 undefined
37%
20 4 6 Not found
8%
20 4 3 Not found
π3π₯2β€1
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');
What is the output?
Anonymous Quiz
20%
{ id: 42, count: 3 }
34%
{ id: 42, name: 'Item', count: 2 }
42%
{ id: 42, name: 'Item', count: 3 }
4%
{ count: 3 }
π₯4β€3π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
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