JavaScript
32K subscribers
1.04K photos
10 videos
33 files
717 links
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
Download Telegram
πŸ‘8πŸ€”6πŸ”₯4❀1
SPONSORED BY Lantern Cloud πŸ‘―β€β™€οΈ
Vector database on top of Postgres for AI

πŸ’» What we got wrong about HTTP imports

Ryan Dahl
Please open Telegram to view this post
VIEW IN TELEGRAM
❀3πŸ‘3πŸ”₯1
SPONSORED BY Lantern Cloud πŸ‘―β€β™€οΈ
Vector database on top of Postgres for AI

❓ CHALLENGE

function* fibGenerator() {
let a = 0, b = 1;
while (true) {
let next = a + b;
a = b;
b = next;
yield next;
}
}

const gen = fibGenerator();
const fibArray = Array.from({ length: 5 }, () => gen.next().value);

console.log(fibArray);
Please open Telegram to view this post
VIEW IN TELEGRAM
❀4🀩1
πŸ”₯7πŸ‘6
SPONSORED BY Lantern Cloud πŸ‘―β€β™€οΈ
Vector database on top of Postgres for AI

πŸ€” JS-PyTorch: A PyTorch-Like Library for JavaScript

Recently renamed from JS-Torch, this brings some of the magic from Python’s popular PyTorch library to JavaScript for training and testing neural networks in particular. We linked to it earlier this year, but it has added GPU support thanks to GPU.js.

Eduardo Leao
Please open Telegram to view this post
VIEW IN TELEGRAM
❀6πŸ‘3πŸ”₯2
CHALLENGE

function* alternatingGenerator() {
yield 1;
yield 2;
yield 3;
}

const gen = alternatingGenerator();
const result = [gen.next().value, gen.next().value, gen.next().value].reduce((acc, curr) => acc + curr, 0);

console.log(result);
πŸ‘1
What is the output?
Anonymous Quiz
23%
0
33%
Error
23%
123
21%
6
πŸ‘7❀6πŸ”₯4🀩2
🌲 Neon: Rust Bindings for Writing Node.js Modules

Or, as they put it: β€œElectrify Node.js with the power of Rust.” Neon makes it relatively easy to write code in the popular, high speed systems language and run it from Node, much like any other native extension.

Neon Contributors
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘7πŸ”₯4❀2
CHALLENGE

function* reverseGenerator(arr) {
for (let i = arr.length - 1; i >= 0; i--) {
yield arr[i];
}
}

const result = [...reverseGenerator([1, 2, 3, 4, 5])].join('');

console.log(result);
πŸ‘3πŸ€”1
πŸ‘16❀5πŸ”₯4
🀟 Node.js Toolbox: A Way to Find and Compare Node.js Packages

A fantastic community maintained resource that presents a category-based way to find packages and libraries. For example, you can check out HTTP frameworks, browser testing, query builders, and more. You can compare libraries in various ways, see their download count, or edit/submit listings yourself.

Maxim Orlov
Please open Telegram to view this post
VIEW IN TELEGRAM
❀6πŸ”₯3πŸ‘2
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
πŸ‘14❀8πŸ”₯7
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯11❀5πŸ‘2πŸ€”2
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
What is the output?
Anonymous Quiz
32%
[1, 2, 3]
19%
[1, 3]
38%
[2]
11%
Error
πŸ‘3πŸ”₯1
🌲 🧡 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.
Please open Telegram to view this post
VIEW IN TELEGRAM
❀6πŸ‘4πŸ”₯2
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
What is the output?
Anonymous Quiz
41%
"inner value"
13%
Error
35%
undefined
11%
null
πŸ‘14❀4πŸ€”4πŸ”₯1
πŸ“Έ 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
Please open Telegram to view this post
VIEW IN TELEGRAM
❀5πŸ‘3πŸ”₯2
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