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
Help us get to know our diverse audience! Please select the region or country where you're currently located. Your input will assist us in tailoring our content to better suit your interests and preferences. Thank you for participating!
Anonymous Poll
8%
US
12%
Europe
6%
Arab countries
12%
Asian countries
15%
African countries
8%
Armenia
2%
Georgia
10%
Russia
2%
Brazil
25%
India
20πŸ‘11❀6πŸ€”6🀣6🀩4
❓ CHALLENGE

function recursiveNQueens(n) {
const board = Array.from({ length: n }, () => Array.from({ length: n }, () => "."));

const solutions = [];

const isSafe = (row, col) => {
for (let i = 0; i < row; i++) {
if (board[i][col] === "Q") return false;
const colOffset = row - i;
if (col - colOffset >= 0 && board[i][col - colOffset] === "Q") return false;
if (col + colOffset < n && board[i][col + colOffset] === "Q") return false;
}
return true;
};

const placeQueens = (row) => {
if (row === n) {
solutions.push(board.map(row => row.join("")));
return;
}
for (let col = 0; col < n; col++) {
if (isSafe(row, col)) {
board[row][col] = "Q";
placeQueens(row + 1);
board[row][col] = ".";
}
}
};

placeQueens(0);

return solutions;
}

const result = recursiveNQueens(4);

console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
❀2πŸ‘1
Please open Telegram to view this post
VIEW IN TELEGRAM
12πŸ‘3❀2
❓ CHALLENGE


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

const sum = numbers.reduce((acc, curr) => {
setTimeout(() => {
acc += curr;
}, 0);
return acc;
}, 0);

console.log(sum);
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘86❀2
πŸ€”23🀣66❀3πŸ‘2🀩1
⭐️ Updates from the TC39 meeting in February 2024

Stage changes:

- Several proposals advanced to stage 1.
- Stage 2: β€œPromise.try”
- Stage 3: β€œUint8Array to/from base64 and hex”
- Stage 4: β€œArrayBuffer.prototype.transfer and friends”
- Several proposals became inactive.

New ECMAScript proposal stage: 2.7

🟨 β€œStage 2.7 is equivalent to what we used to call Stage 3. It means that the design is considered complete, we have a full specification, and we need to write code (tests and non-polyfill implementations) to gain feedback and make progress. It’s a strong signal.”

πŸŸ¨β€œStage 3 has been strengthened and now also means that test262 conformance tests are ready. This is a useful signal to JS engines that a proposal is truly ready to be implemented.”

πŸŸ¨β€œWhy did we do this? We separated out the β€˜Approved in Principle: Spec Ready’ stage from the later β€˜Recommended for Implementation: Tests Ready’ stage to reduce wasted effort in writing tests before spec stability, whilst also clarifying the test readiness message to engines.”

TC39 member Jordan Harband comments: β€œ[Stage 2.7 is] explicitly without the signal that it’s safe to ship unflagged, or use in production (which includes publishing polyfills). Stage 3 remains the signal for these things.”


ecmascript.new
Please open Telegram to view this post
VIEW IN TELEGRAM
5πŸ‘4❀3🀣1
❓ CHALLENGE

function recursiveMaxSubarraySum(nums, startIndex = 0, currentSum = 0, maxSum = -Infinity) {
if (startIndex === nums.length) {
return maxSum;
}

currentSum = Math.max(nums[startIndex], currentSum + nums[startIndex]);
maxSum = Math.max(currentSum, maxSum);

return recursiveMaxSubarraySum(nums, startIndex + 1, currentSum, maxSum);
}

const result = recursiveMaxSubarraySum([-2, 1, -3, 4, -1, 2, 1, -5, 4]);

console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
10πŸ‘6🀣3
What is the output?
Anonymous Quiz
23%
8
42%
11
17%
9
18%
6
πŸ‘136❀3
πŸ’₯ Questions by roadmap.sh

roadmap.sh is the 6th most starred project on GitHub and is visited by hundreds of thousands of developers every month.
Please open Telegram to view this post
VIEW IN TELEGRAM
8❀3πŸ‘3
❓ CHALLENGE *

const string = "Lorem ipsum dolor sit amet";

const result = string.split(" ")
.map(word => word.toLowerCase())
.reduce((acc, word) => {
acc[word] = (acc[word] || 0) + 1;
return acc;
}, {});

console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
8πŸ‘4❀2πŸ€”2
🀟 πŸ’š The Node.js Valentine's Day Security Releases

Security releases had been expected to land in the past week for Node and they’re now here as v21.6.2 (Current), v20.11.1 (LTS), and v18.19.1 (LTS). They include fixes for a variety of vulnerabilities, including some high severity ones involving HTTP-based DoS attacks and privilege escalation.

RAFAEL GONZAGA AND MARCO IPPOLITO
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘55❀4πŸ€”1
πŸ˜‚
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣82πŸ‘9❀85🀩3
❓ CHALLENGE

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

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

console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
❀9πŸ‘62
What is the output?
Anonymous Quiz
18%
6
62%
20
12%
30
7%
54
12πŸ€”9❀6πŸ‘2
🀩 Tabulator: An Interactive Table and Data Grid Library

Supports all major browsers and can be used with Angular, Vue, and React if you wish. Been around for several years now, but continues to be maintained.

OLI FOLKERD
Please open Telegram to view this post
VIEW IN TELEGRAM
6❀3πŸ‘3🀣1
Please open Telegram to view this post
VIEW IN TELEGRAM
8❀6🀣5πŸ€”4πŸ‘2
❓ CHALLENGE

const string = "Hello, World! How are you?";

const result = string.match(/[aeiou]/g).reduce((acc, char) => {
acc[char] = (acc[char] || 0) + 1;
return acc;
}, {});

console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘6
⚠️ Node.js Developers Debate Enabling Corepack by Default and Potentially Unbundling npm

Node developers are wrestling with the decision to enable Corepack (a tool for managing package managers) by default, which has sparked a debate about the possibility of removing npm from the Node.js binary.

SARAH GOODING (SOCKET)
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ€”63❀2πŸ‘2🀩1