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
899

Showing posts older than #2032 Β· Back to latest

Older Posts 20 shown
Post #2031 6.88K
🀨 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
  • πŸ‘ 6
  • ❀ 3
  • πŸ”₯ 1
Post #2030 6.61K
  • 🀣 18
  • πŸ€” 10
  • πŸ‘ 7
  • ❀ 3
  • 🀩 1
Post #2029 6.66K
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
Post #2028 6.58K
🀟 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
  • ❀ 7
  • πŸ‘ 4
  • πŸ”₯ 4
Post #2027 6.67K
  • πŸ‘ 15
  • πŸ€” 7
  • 🀣 6
  • πŸ”₯ 3
Post #2026 6.45K
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
Post #2025 6.91K
  • πŸ€” 26
  • πŸ‘ 8
  • πŸ”₯ 7
  • ❀ 4
Post #2024 6.73K
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
Post #2023 6.45K
πŸ€” 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
  • πŸ”₯ 4
  • πŸ‘ 3
  • ❀ 1
Post #2022 6.73K
  • πŸ€” 24
  • πŸ‘ 7
  • 🀣 7
  • πŸ”₯ 3
Post #2021 6.6K
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
Post #2019 7.26K
  • πŸ€” 21
  • πŸ‘ 8
  • ❀ 4
  • πŸ”₯ 3
Post #2018 6.74K
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
  • πŸ€” 4
Post #2017 6.87K
⛽️ 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
  • ❀ 9
  • πŸ‘ 7
  • πŸ”₯ 2
Post #2016 6.28K
  • πŸ‘ 18
  • ❀ 5
  • πŸ”₯ 4
  • 🀩 1
Post #2015 6.29K
CHALLENGE

var arr = Array.from({ length: 5 }, (v, i) => i * 2);
console.log(arr);
  • πŸ‘ 3
Post #2013 6.62K
  • ❀ 17
  • πŸ‘ 14
  • πŸ€” 6
  • 🀩 1
Post #2012 6.26K
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);
  • πŸ‘ 10
  • 🀣 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 β†’