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
31K
Photos
1.2K
Videos
10
Links
901

Showing posts older than #1591 ยท Back to latest

Older Posts 20 shown
Post #1590 6.41K
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

โ“ CHALLENGE


const weakMap = new WeakMap();
const obj = {};

(function() {
const internalObj = {};
weakMap.set(internalObj, 'hidden');
obj.ref = internalObj;
})();

delete obj.ref;

const result = weakMap.has(obj.ref);

console.log(result);
  • ๐Ÿ”ฅ 7
  • ๐Ÿค” 6
  • ๐Ÿ‘ 5
  • โค 3
Post #1589 6.22K
๐Ÿ˜ญ ...
  • ๐Ÿคฃ 51
  • ๐Ÿ‘ 8
  • โค 5
  • ๐Ÿ”ฅ 1
  • ๐Ÿค” 1
Post #1588 6.08K
  • ๐Ÿ‘ 11
  • ๐Ÿค” 5
  • โค 4
  • ๐Ÿ”ฅ 1
Post #1587 6.24K
CHALLENGE

const weakMap = new WeakMap();
const array = [{}, {}];

array.forEach(obj => weakMap.set(obj, obj));
const result = array.map(obj => weakMap.get(obj) === obj);

console.log(result);
  • ๐Ÿ‘ 8
Post #1586 6.54K
โœŒ๏ธ ECMAScript Safe Assignment Operator Proposal

We often feature ECMAScript proposals that are in their later stages, but how about a brand new one you could get involved with? This one proposes an interesting additional bit of language syntax (`?=`) that returns a [error, value] tuple from an assignment.

Arthur Fiorette
  • ๐Ÿ‘ 7
  • ๐Ÿค” 7
  • โค 4
  • ๐Ÿ”ฅ 2
Post #1585 6.01K
  • ๐Ÿ‘ 10
  • ๐Ÿ”ฅ 6
  • ๐Ÿค” 5
  • โค 4
Post #1584 6.3K
CHALLENGE

const weakMap = new WeakMap();
const gen = (function* () {
yield { key: 'value1' };
yield { key: 'value2' };
})();

const obj1 = gen.next().value;
const obj2 = gen.next().value;

weakMap.set(obj1, 'stored value1');
weakMap.set(obj2, 'stored value2');

const result = [...gen].map(obj => weakMap.get(obj));

console.log(result);
  • ๐Ÿ‘ 7
  • โค 5
  • ๐Ÿ”ฅ 3
  • ๐Ÿคฉ 2
Post #1583 6.9K
๐Ÿ˜‰ A day as a Remote Software Engineer in Helsinki, Finland

I've always wanted to create a video series to share my experiences and work style as a remote software engineer. I finally started this journey and am excited to make more videos like this...

nairi
  • ๐Ÿ‘ 18
  • ๐Ÿ”ฅ 7
  • โค 5
  • ๐Ÿค” 2
  • ๐Ÿคฉ 1
Post #1582 6.36K
  • ๐Ÿ‘ 11
  • โค 4
  • ๐Ÿค” 4
  • ๐Ÿ”ฅ 3
Post #1581 6.59K
CHALLENGE

const weakMap = new WeakMap();
const obj = {};
const gen = (function* () {
yield 'value1';
yield 'value2';
})();

weakMap.set(obj, gen.next().value);

console.log(weakMap.get(obj));
console.log(gen.next().value);
  • ๐Ÿ‘ 4
Post #1580 7.09K
๐Ÿ“ธ Immerse Yourself in Generative Art: An Angular WebXR Adventure

If you missed the Google I/O Angular session, you missed not only the latest updates on Angular but also the Generative Art Gallery demo which I had so much fun building. The demo has all of my favorite technologies, including AI, Angular and WebXR. It also was a very pleasant developer experience. Let me tell you why!

AyลŸegรผl Yรถnet
  • โค 5
  • ๐Ÿ‘ 3
  • ๐Ÿ”ฅ 2
Post #1579 5.9K
  • ๐Ÿ‘ 14
  • โค 4
  • ๐Ÿค” 4
  • ๐Ÿ”ฅ 1
Post #1578 6.28K
CHALLENGE

const weakMap = new WeakMap();
const obj = {};

(function() {
const obj1 = { name: 'inner' };
weakMap.set(obj1, 'inner value');
})();

const result = weakMap.get(obj);

console.log(result);
  • ๐Ÿ‘ 8
Post #1577 6.69K
๐ŸŒฒ ๐Ÿงต worker_map: Tread-safe map structure for worker_threads

A simple abstraction for Node.js worker_threads, allowing you to create and share a Map (hash table) between worker threads and the main process.
  • โค 6
  • ๐Ÿ‘ 4
  • ๐Ÿ”ฅ 2
Post #1576 6.53K
  • ๐Ÿ‘ 3
  • ๐Ÿ”ฅ 1
Post #1575 6.27K
CHALLENGE

function* idGenerator() {
let id = 1;
while (true) {
yield id++;
}
}

const gen = idGenerator();
const weakMap = new WeakMap();
const objs = [{}, {}, {}];

objs.forEach(obj => weakMap.set(obj, gen.next().value));

const result = objs.map(obj => weakMap.get(obj)).filter(id => id % 2 === 0);

console.log(result);
  • ๐Ÿ‘ 5
  • โค 4
  • ๐Ÿ”ฅ 2
Post #1573 6.52K
  • ๐Ÿ‘ 14
  • โค 8
  • ๐Ÿ”ฅ 7
Post #1572 6.24K
CHALLENGE

const weakMap = new WeakMap();
const obj1 = {};
const obj2 = {};

weakMap.set(obj1, 'value1');
weakMap.set(obj2, 'value2');

const arr = [obj1, obj2];
const result = arr.map(obj => weakMap.get(obj)).join(', ');

console.log(result);
  • ๐Ÿ‘ 3
  • โค 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 โ†’