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 #2113 Β· Back to latest

Older Posts 20 shown
Post #2112 5.76K
CHALLENGE

const arr = [1, 2, 3, 4, 5];
const result = arr
.map(x => x * 2)
.filter(x => x > 5)
.reduce((acc, val) => {
return acc + (val % 3 === 0 ? val : 0);
}, 0);

console.log(result);
  • πŸ‘ 12
Post #2111 6.02K
🟠 Svelvet 11: Build Node-Based UIs with Svelte

A mature Svelte component library for creating interactive node-based UIs and diagrams. v11 adds the ability to toggle between β€˜snap grid’ and freeform modes for manipulating elements. (There’s a live demo at the bottom of the homepage.)

Open Source Labs
  • πŸ‘ 4
  • πŸ”₯ 2
  • ❀ 1
Post #2110 5.84K
  • πŸ€” 16
  • πŸ‘ 15
  • 🀣 5
  • ❀ 4
  • πŸ”₯ 4
Post #2109 5.75K
CHALLENGE

const user = {
name: 'John',
greet() {
const getName = () => {
console.log(this.name);
};
getName();
},
farewell: function() {
function getName() {
console.log(this.name);
}
getName();
}
};

user.greet();
user.farewell();
  • πŸ‘ 2
Post #2108 5.85K
πŸ₯Ά Developer Implements 'Doom' in TypeScript's Type System

A curious quirk of TypeScript’s type system is that it is Turing-complete which has led some developers to implement apps entirely in the type system. One such developer has spent eighteen months producing 177 terabytes of types to get 1993’s Doom running with them. Ridiculous and amazing in equal measure, he πŸ˜‰ explains the project in this widely lauded 7-minute video.

Sarah Gooding (Socket)
  • πŸ‘ 8
  • ❀ 5
  • πŸ”₯ 4
Post #2107 5.41K
  • πŸ€” 18
  • πŸ‘ 10
  • ❀ 5
  • 🀣 2
Post #2106 5.71K
CHALLENGE

let x = 1;
function outer() {
let x = 2;
function inner() {
console.log(x);
let x = 3;
}
inner();
}
outer();
  • πŸ‘ 6
  • ❀ 2
Post #2104 6.18K
  • πŸ‘ 11
  • 🀣 11
  • ❀ 6
  • πŸ€” 2
  • πŸ”₯ 1
Post #2103 5.9K
CHALLENGE

function trickyFunction(a) {
a = a || 42;
let result = (function(a) {
return a * 2;
})(a);
return result;
}

console.log(trickyFunction(0));
  • πŸ‘ 8
  • ❀ 2
Post #2102 6.27K
πŸ₯Ά upfetch: An Advanced fetch Client Builder

A TypeScript library to enhance fetch with schema validation, automatic response parsing, and type-safety, while maintaining the familiar ՝fetch՝ API.

Laurent Blondy
  • πŸ”₯ 8
  • πŸ‘ 4
  • ❀ 3
Post #2101 5.94K
  • 🀣 23
  • πŸ€” 13
  • πŸ‘ 10
  • ❀ 3
Post #2100 5.84K
CHALLENGE

let a = 5; // binary: 0101
let b = 3; // binary: 0011
let c = a & b; // binary: 0001
let d = a | b; // binary: 0111
let e = a ^ b; // binary: 0110

console.log(c, d, e);
  • πŸ‘ 7
  • ❀ 1
Post #2099 6.04K
πŸ€” Subverting Control with Weak References

Node supports WeakMap and WeakRef for working with weak references and James is a big fan of the extra abstractions they unlock. A weak reference differs from a normal reference in that it doesn’t prevent a referenced object from being garbage collected – this might sound like it has limited value, but is quite useful in certain scenarios.

James Long
  • ❀ 7
  • πŸ‘ 4
  • πŸ”₯ 1
Post #2097 5.54K
  • πŸ€” 30
  • πŸ”₯ 12
  • ❀ 5
  • πŸ‘ 3
  • 🀣 3
Post #2096 5.86K
CHALLENGE

function trickyQuestion() {
var a = 1;
var b = 2;

return (function() {
delete a;
delete b;
return a + b;
})();
}

console.log(trickyQuestion());
  • πŸ€” 11
  • πŸ‘ 5
Post #2094 5.62K
  • πŸ‘ 23
  • πŸ€” 6
  • ❀ 3
  • πŸ”₯ 3
  • 🀣 2
Post #2093 5.88K
CHALLENGE

function trickyScope() {
let x = 10;
if (true) {
let x = 20;
console.log(x); // A
}
console.log(x); // B
{
let x = 30;
console.log(x); // C
}
console.log(x); // D
}

trickyScope();
  • πŸ”₯ 9
  • πŸ‘ 4
  • ❀ 1
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 β†’