JavaScript
31.9K subscribers
1.01K photos
9 videos
33 files
693 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
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πŸ‘6πŸ”₯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
What is the output?
Anonymous Quiz
23%
60
37%
45
20%
15
20%
30
πŸ€”25πŸ‘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❀1
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
CHALLENGE

const wm = new WeakMap();
const obj1 = {};
const obj2 = {};
wm.set(obj1, 'object 1');
wm.set(obj2, 'object 2');
wm.delete(obj1);
console.log(wm.has(obj1));
πŸ‘9
What is the output?
Anonymous Quiz
27%
undefined
22%
true
44%
false
8%
TypeError
🀣15πŸ‘9❀5πŸ€”4
😱 jscanify 1.3: JavaScript Document Scanning Library

Given raw photos of documents, this can do paper detection (along with glare suppression), distortion correction, highlighting and extracting. See some visual examples or try it out here.

ColonelParrot
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯8❀3πŸ‘3πŸ€”1
CHALLENGE

const numbers = [1, 2, 3, 4, 5];

const result = numbers
.filter(n => n % 2 === 0)
.map(n => n * 2)
.reduce((acc, n) => acc + n, 0);

console.log(result);
❀5πŸ‘1
What is the output?
Anonymous Quiz
11%
8
12%
0
70%
12
7%
4
πŸ‘21πŸ€”6πŸ”₯5❀3
CHALLENGE

const person = {
name: 'Alice',
age: 25,
city: 'Wonderland'
};

const additionalInfo = {
age: 30,
occupation: 'Explorer'
};

const combined = {
...person,
...additionalInfo
};

console.log(combined.age);
πŸ‘12πŸ”₯3
What is the output?
Anonymous Quiz
9%
null
16%
25
57%
30
18%
undefined
πŸ‘22πŸ”₯4❀2
CHALLENGE

function example() {
console.log(a);
var a = 10;
console.log(a);
}
example();
πŸ‘2πŸ€”2
❀22πŸ‘18🀣6πŸ”₯3