JavaScript
32.1K subscribers
1.06K photos
10 videos
33 files
737 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 fetchData(url) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (url.startsWith('https://api.example.com')) {
resolve({ data: 'Some data' });
} else {
reject(new Error('Invalid URL'));
}
}, 1000);
});
}

fetchData('https://api.example.com/data')
.then(response => console.log(response.data))
.catch(error => console.error(error));
Please open Telegram to view this post
VIEW IN TELEGRAM
❀11πŸ‘11πŸ€”33
πŸ“– VSCode shortcuts for you
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘60❀1613πŸ€”7🀩3🀣3
❓ CHALLENGE

class Rectangle {
constructor(width, height) {
this.width = width;
this.height = height;
}

get area() {
return this.width * this.height;
}
}

const rectangle = new Rectangle(5, 10);
console.log(rectangle.area());
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘14🀣2
🀟 Preventing SQL Injection Attacks in Node

Learn more about why and where SQL injection attacks pose a threat and some initial ways to shield your Node apps against them.

LUCIEN CHEMALY
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘13❀44
❓ CHALLENGE

const obj = { a: 1, b: 2 };
const key = 'c';
console.log(obj[key]);
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘16❀43
28πŸ‘6🀣4❀2πŸ€”1
πŸ’» JSR: What We Know So Far About Deno’s New JS Package Registry

The Deno team is cooking up JSR (still behind a waitlist), a new JavaScript package registry (not merely a package management tool, like pnpm or Yarn) to address various npm limitations, including for Node users who don't even plan to use Deno.

SARAH GOODING
Please open Telegram to view this post
VIEW IN TELEGRAM
7πŸ‘4❀3πŸ€”1
❓ CHALLENGE

const promise = new Promise((resolve, reject) => {
setTimeout(() => {
resolve('Resolved');
reject(new Error('Rejected'));
}, 1000);
});

promise.then(response => console.log(response)).catch(error => console.error(error));
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘11❀5
πŸ˜‚
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣937❀4πŸ‘3🀩2πŸ€”1
CHALLENGE ❓
function asyncQuiz() {
return new Promise((resolve) => {
setTimeout(() => resolve('Hello'), 1000);
});
}

async function runAsyncQuiz() {
const result = await asyncQuiz();
console.log(result);
}

runAsyncQuiz();
console.log('World');
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘11
❀2212πŸ€”9
Last minute fix πŸ˜…
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣9912πŸ‘5πŸ€”3🀩3
❓CHALLENGE


var a = 1;

function scopeQuiz() {
console.log(a);
var a = 2;
}

scopeQuiz();
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ€”23πŸ‘13❀72
What is the output?
Anonymous Quiz
41%
1
36%
2
18%
undefined
5%
Error
πŸ€”348πŸ‘6❀4🀩1
πŸ˜‚
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣98πŸ‘139πŸ€”5❀1🀩1
❓ CHALLENGE

function delayedLog(item) {
setTimeout(() => {
console.log(item);
}, 1000);
}
for (var i = 0; i < 3; i++) {
delayedLog(i);
}
Please open Telegram to view this post
VIEW IN TELEGRAM
6❀2
πŸ‘1313❀9🀣8πŸ€”1