JavaScript
32K subscribers
1.04K photos
10 videos
33 files
718 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
πŸ•’ JavaScript Temporal is Coming (For Real!)

We first mentioned the Temporal API proposal providing a better way to handle dates and times in JavaScript almost five years ago (in issue 496!) but now it really is almost here. Brian explains its basic concepts and where initial support is starting to appear.

Brian Smith
❀8πŸ‘3πŸ”₯3
CHALLENGE

const person = {
name: "Alice",
age: 30,
city: "New York"
};

const keys = Object.keys(person);
const values = Object.values(person);

const result = keys.map((key, index) => `${key}: ${values[index]}`);

console.log(result);
πŸ‘9🀣5πŸ€”3
🀨 deck.gl 9.1: GPU-Powered Large Scale Data Visualization

deck.gl provides a way to create complex yet high performance data visualizations composed of multiple layers (examples). It can be used in a vanilla JS way or through React components and it’s ready for WebGPU.

OpenJS Foundation
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘14❀6πŸ”₯2
CHALLENGE

var arr = Array.from({ length: 5 }, (v, i) => i * 2);
console.log(arr);
πŸ‘2
πŸ‘18❀5πŸ”₯4🀩1
⛽️ A Failed Attempt to Shrink All npm Packages by 5%

What if you could shrink all npm package sizes by 5%.. wouldn’t that benefit all of us? Here’s how one developer did just that using Zopfli compression and then made a proposal to the npm maintainers to implement it. While promising, the proposal was ultimately rejected due to a variety of challenges and trade-offs, such as slower publishing speeds. Nonetheless, it’s a good story packed with things to learn from.

Evan Hahn
Please open Telegram to view this post
VIEW IN TELEGRAM
❀9πŸ‘7πŸ”₯2
CHALLENGE

function trickyCount(n) {
if (n <= 1) return n;
return trickyCount(n - 1) + trickyCount(n - 2);
}

function wrapCount(n) {
return trickyCount(n) - trickyCount(n - 4);
}

console.log(wrapCount(6));
πŸ‘19πŸ€”3
What is the output?
Anonymous Quiz
30%
7
29%
6
29%
4
12%
5
πŸ€”21πŸ‘8❀4πŸ”₯3
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣47πŸ”₯5πŸ‘4❀1πŸ€”1
CHALLENGE

function mystery(x) {
return (function(y) {
return x + y;
})(x * 2);
}

const result1 = mystery(2);
const result2 = mystery(5);
const result3 = mystery(-1);

console.log(result1, result2, result3);
πŸ‘9
πŸ€”24πŸ‘7🀣7πŸ”₯3
πŸ€” Things People Get Wrong About Electron

A long-time maintainer of the wildly successful Electron cross-platform app framework stands by the technical choices Electron has made over the years and defends it against some of the more common criticisms here.

Felix Rieseberg
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯4πŸ‘3❀1
CHALLENGE

function mysteriousFunction(a) {
let result = 0;
for (let i = 1; i <= a; i++) {
if (i % 3 === 0 && i % 5 === 0) {
result += i * 2;
} else if (i % 3 === 0) {
result += i;
} else if (i % 5 === 0) {
result -= i;
}
}
return result;
}

console.log(mysteriousFunction(15));
🀣19πŸ‘13πŸ€”1
What is the output?
Anonymous Quiz
23%
60
37%
45
20%
15
20%
30
πŸ€”26πŸ‘8πŸ”₯7❀4
CHALLENGE

function tricky() {
let a = 1;
let b = 2;
const result = (function(a) {
a = 3;
return a + b;
})(a);
return result;
}

console.log(tricky());
πŸ‘3❀2
What is the output?
Anonymous Quiz
11%
4
22%
ReferenceError
14%
3
53%
5
πŸ‘15πŸ€”7🀣6πŸ”₯3
🀟 The Modern Way to Write JavaScript Servers

The irony is that while Node popularized JavaScript on the server (though Netscape was doing it in the 90s) this modern, standardized cross-runtime approach doesn’t work on Node ...yet ;-)

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


let symbol1 = Symbol('description');
let symbol2 = Symbol('description');

const obj = {
[symbol1]: 'value1',
[symbol2]: 'value2'
};

console.log(obj[symbol1]);
console.log(symbol1 === symbol2);
πŸ”₯4πŸ‘2
🀣18πŸ€”10πŸ‘7❀3🀩1
🀨 docxtemplater: Generate docx and pptx Documents from Templates

Generate Word and PowerPoint files dynamically by merging against templates (ideal for invoices, contracts, certificates, etc.) It’s open source (MIT or GPLv3), but the creator has a commercial version with more extensions (e.g. to work with Excel). GitHub repo and feature demos.

Edgar Hipp
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘6❀3πŸ”₯1