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
895

Showing posts older than #3044 · Back to latest

Older Posts 20 shown
Post #3043 3.08K
  • 👍 7
  • ❤ 2
Post #3042 2.99K
CHALLENGE

const name = "Zara";
const age = 28;
const role = "engineer";

const user = { name, age, role };

const { name: fullName, age: years, role: position = "developer" } = user;

const greet = ({ name, age }) => `${name} is ${age}`;

const team = [
{ name: "Zara", age: 28 },
{ name: "Leo", age: 34 },
];

const [{ name: first }, { age: secondAge }] = team;

console.log(`${fullName}, ${years}, ${position} | ${first}, ${secondAge}`);
  • ❤ 6
  • 👍 4
  • 🔥 2
Post #3041 3.04K
🤟 Node.js EventLoop Lag + Kafka Consumer Lag: One Root Cause

The 3-Second Production Mystery That Took Me 20 Days to Solve

This is a story about how we found a 3s EventLoop lag (p99) in one of our microservices while exploring the Kafka consumer lag… and how I tracked it down and fixed.

It’s Feb 6. I notice an increase in Kafka lag in our Grafana chart...

nairihar
  • ❤ 7
  • 👍 6
  • 🔥 4
Post #3040 2.91K
😮 numpy-ts: A NumPy Implementation for TypeScript

NumPy is a fundamental piece of the Python scientific computing ecosystem and well-entrenched in many use cases. JavaScript has some options in this regard (e.g. TensorFlow.js), but numpy-ts is an attempt to replace the NumPy experience as closely as possible (currently at 94% API coverage). There’s an online playground if you want to give it a quick spin.

Nicolas Dupont
  • ❤ 12
  • 🔥 5
  • 👍 3
Post #3039 2.88K
  • 👍 6
  • ❤ 4
  • 🔥 1
Post #3038 3.08K
CHALLENGE



let x = 'global';

function testScope() {
console.log(x);

if (true) {
let x = 'block';
var y = 'function';
console.log(x);
}

console.log(x);
console.log(y);
}

testScope();
  • 🔥 7
  • 👍 3
  • ❤ 1
Post #3037 2.65K
👀 AdonisJS v7 Released: 'Batteries-Included' Node.js Framework

A popular webapp framework that includes auth, ORM, queues, testing, etc. in a cohesive fashion. With v7 comes an all new web site, modernizations, OpenTelemetry integration, new starter kits to rapidly build new apps, barrel file generation, and end-to-end type safety.

Harminder Virk
  • 👍 8
  • 🔥 5
  • ❤ 1
Post #3036 2.77K
  • ❤ 3
  • 👍 3
  • 🔥 2
Post #3035 2.91K
CHALLENGE


const user = {
profile: {
getName: () => "Marcus",
getAge: () => 30,
},
settings: null,
};

const name = user.profile?.getName?.();
const age = user.profile?.getAge?.();
const theme = user.settings?.getTheme?.() ?? "dark";
const lang = user.address?.getLocale?.() ?? "en-US";

console.log(`${name} | ${age} | ${theme} | ${lang}`);
  • ❤ 6
  • 👍 3
Post #3034 2.62K
🫶 Play with a complete Windows 3.11 environment in your browser. A lot of fun! There's a recreation of 90s search engine Altavista (above), a version of mIRC that connects to an actual IRC server, and a variety of classic games.
  • 👍 9
  • 🔥 6
  • ❤ 4
Post #3033 2.99K
  • ❤ 5
  • 👍 1
  • 🤩 1
Post #3032 3.01K
CHALLENGE



const inventory = {
apples: 5,
bananas: 0,
cherries: 12,
dates: undefined,
elderberries: null,
};

const summary = Object.entries(inventory)
.filter(([_, value]) => value)
.reduce((acc, [key, value]) => {
acc[key] = value * 2;
return acc;
}, {});

console.log(Object.keys(summary).length);
console.log(Object.values(summary).every(v => v > 10));
console.log(Object.keys(inventory).length === Object.keys(summary).length);
  • 🔥 3
  • ❤ 1
  • 👍 1
Post #3031 2.65K
⚡️ Beautiful Mermaid 1.0

Render Mermaid diagram markup to SVG or ASCII/Unicode outputs (above) from JavaScript.
  • 🔥 9
  • ❤ 7
  • 👍 3
Post #3030 3.06K
  • 👍 11
  • ❤ 2
  • 🔥 2
Post #3029 3.06K
CHALLENGE


class Session {
#id;
constructor(id) {
this.#id = id;
}
getId() { return this.#id; }
}

const activeSessions = new WeakSet();

const s1 = new Session("user_42");
const s2 = new Session("user_99");
let s3 = new Session("user_07");

activeSessions.add(s1);
activeSessions.add(s2);
activeSessions.add(s3);

console.log(activeSessions.has(s1)); // line A
console.log(activeSessions.has(s3)); // line B

s3 = null;

console.log(activeSessions.has(s3)); // line C

activeSessions.delete(s2);
console.log(activeSessions.has(s2)); // line D
console.log(activeSessions.size); // line E
  • ❤ 7
  • 👍 3
  • 🔥 1
Post #3028 2.71K
😃 OpenSeadragon 6.0: A Web Viewer for High Resolution Images

A big step forward for a project that’s almost 15 years old, and one of few stable, trusty options for rendering ultra-high resolution images for users to zoom into and pan around. Version 6 introduces a new async and cache-managed pipeline, making it far more efficient at scale.

OpenSeadragon Contributors
  • ❤ 5
  • 🔥 5
  • 👍 3
  • 🤩 1
Post #3027 2.72K
  • ❤ 4
  • 👍 2
Post #3026 2.89K
CHALLENGE


const compose = (...fns) => (x) => fns.reduceRight((acc, fn) => fn(acc), x);
const pipe = (...fns) => (x) => fns.reduce((acc, fn) => fn(acc), x);

const double = (x) => x * 2;
const addTen = (x) => x + 10;
const square = (x) => x * x;
const negate = (x) => -x;

const transform1 = compose(negate, square, addTen, double);
const transform2 = pipe(double, addTen, square, negate);

const input = 3;

console.log(transform1(input));
console.log(transform2(input));
console.log(transform1(input) === transform2(input));
  • 👍 6
  • ❤ 4
  • 🔥 1
Post #3025 2.75K
👀 The Fastest Frontend Tooling for Humans and AI

Christoph (of Jest fame) covers his preferred tools for getting your JavaScript tool stack running as fast as possible. It’s also intended for LLMs to process via this Markdown version.

Christoph Nakazawa
  • 🔥 6
  • ❤ 5
  • 👍 3
Post #3024 2.92K
  • ❤ 5
  • 👍 3
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 →