tgindex

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

31 312
подписчиков

Лучшие посты

за три месяца
  • 6 авг.1 885 просмотров4 реакций

    без подписи

  • 7 авг.1 879 просмотров8 реакций

    без подписи

  • 5 авг.1 784 просмотров9 реакций

    без подписи

  • 5 авг.1 781 просмотров5 реакций

    CHALLENGE function tag(strings, ...values) { return strings.raw.join('|') + '=' + values.reduce((sum, v) => sum + v, 0); } const x = 5; const y = 10; console.log(tag`Sum\n${x}and${y}end`);

  • 8 авг.1 772 просмотров8 реакций1 пересылок

    без подписи

  • 10 авг.1 728 просмотров7 реакций1 пересылок

    без подписи

  • 8 авг.1 717 просмотров10 реакций1 пересылок

    CHALLENGE let arr = []; for (let i = 0; i < 3; i++) { if (i === 1) { let i = 10; arr.push(i); continue; } arr.push(i); } console.log(arr.join('-'));

  • 6 авг.1 699 просмотров5 реакций3 пересылок

    CHALLENGE const order = []; const log = (s) => order.push(s); log('start'); Promise.resolve().then(() => { log('p1'); return Promise.resolve(); }).then(() => log('p1-2')); async function foo() { log('foo-start'); await null; log('foo-end'); } foo(); Promise.resolve().then(() => log('p2')); log('end'); setTimeout(() => console.log(order.join(' ')), 0);

  • 9 авг.1 685 просмотров1 реакций1 пересылок

    без подписи

  • 9 авг.1 648 просмотров2 реакций1 пересылок

    CHALLENGE class Config { constructor(options = {}) { this.retries = options.retries ?? 3; this.timeout = options.timeout ?? 1000; } } const cfg1 = new Config({ retries: 0, timeout: null }); const cfg2 = new Config({ retries: undefined, timeout: false }); cfg1.retries ??= 99; cfg2.timeout ??= 99; console.log(cfg1.retries, cfg1.timeout, cfg2.retries, cfg2.timeout);

  • 7 авг.1 638 просмотров11 реакций

    CHALLENGE const a = [] + {}; const b = {} + []; const c = 1 + '1' - 1; const d = '5' + 3 - 2; const e = true + true; console.log(a, b, c, d, e);

  • 11 авг.1 631 просмотров4 реакций2 пересылок

    👀 Next.js 16.3 Released The newly expanded Next.js team (now including Dan Abramov and 𝕏 Pete Hunt!) has dropped the latest version of the popular React framework, complete with faster builds, optional TypeScript 7 type checking, faster SSR, Instant Navigations, AI improvements, and more. The Next.js Team

  • 11 авг.1 614 просмотров3 реакций

    без подписи

  • 11 авг.1 597 просмотров2 реакций

    CHALLENGE function memoize(fn) { const cache = new Map(); return (...args) => { const key = JSON.stringify(args); if (cache.has(key)) return cache.get(key); const result = fn(...args); cache.set(key, result); return result; }; } let calls = 0; const add = memoize((a, b) => { calls++; return a + b; }); const r1 = add(1, 2); const r2 = add(2, 1); const r3 = add(1, 2); console.log(r1, r2, r3, calls);

  • 10 авг.1 540 просмотров6 реакций2 пересылок

    CHALLENGE const Loggable = { log() { return `[${this.constructor.name}] ${this.toString()}`; } }; class Base { toString() { return 'Base instance'; } } Object.setPrototypeOf(Base.prototype, Loggable); class Derived extends Base { toString() { return 'Derived instance'; } } const b = new Base(); const d = new Derived(); console.log(b.log(), d.log(), Object.getPrototypeOf(Derived.prototype) === Base.prototype);

  • 12 авг.1 411 просмотров3 реакций

    без подписи

  • 12 авг.1 406 просмотров5 реакций1 пересылок

    CHALLENGE const str = "2024-01-15"; const result = str.replace(/(\d+)-(\d+)-(\d+)/, "$3/$2/$1"); const s2 = "abc".padStart(6, "12"); const s3 = [..."hello"].reverse().join(""); console.log(result, s2, s3);

  • 12 авг.1 391 просмотров9 реакций3 пересылок

    ↗️ TanStack Charts: A New Chart Grammar Option In the past few weeks, TanStack has been rapidly iterating on a new, framework-neutral way to declaratively specify a large number of chart-related visualizations in JavaScript. Output renders to SVG or canvas and can be styled as you wish. Here's a comparison against other established options. TanStack

  • 13 авг.1 365 просмотров2 реакций3 пересылок

    без подписи

  • 13 авг.1 288 просмотров4 реакций2 пересылок

    🤟 Node.js 26.7.0 (Current) Released Landing just two days after 26.6, coverage reports can now include files your tests didn't touch with --test-coverage-include-all, FFI and SQLite pick up crash fixes, and Perfetto tracing support lands, though you'll need a custom build to use it. Antoine du Hamel