June 2023 Newsletter

Contents 📋

  1. News & Explore
  2. Read & Watch
  3. Challenge

Summer has officially arrived and it's time to enjoy the sun. But before that let's see what happened in the last month.

Before we move forward I'd like to give shoutout to Nurçin (opens in a new tab) for her newsletter Nurçin's Newsletter (opens in a new tab)(She is posting weekly so you are gonna like it.)

News & Explore

Massive Bug on npm Ecosystem

npm is one of the biggest package managers for JavaScript ecosystem along side with Yarn (opens in a new tab) and PNPM (opens in a new tab). But this does not mean it's better and most secure system. Ex-Staff-Engineer from npm CLI team mentioned the issue where: when you install a package can lead to un-secure installs and execution of malicious scripts.

Massive bug (opens in a new tab)

styled-components big release

styled-components (opens in a new tab) is a go to tool for engineers to style their components in their apps. Now there's a new version of the package(v6). Before updating make sure you go through the breaking changes.

Breaking Changes (opens in a new tab)

Vercel with the updates

Vercel(company behind Next.js) has released a software development kit for AI apps, built with React and Svelte. What this means is that while integrating any LLM to your project by using OpenAI, LangChain or Hugging Face you don't need to go through long development cycle to make sure the integration works properly.

Vercel AI SDK (opens in a new tab)

Nest.js upgrades to V10

Nestjs one of the Node.js backend frameworks has got update to v10. Brings swc to complie TypeScript, Redis wildcard supports, dropping Node 12 support, upgrading TypeScript version.

Nest.js v10 (opens in a new tab)


Read & Watch

Cost of JavaScript (opens in a new tab) 📺

Don't be nice, be kind (opens in a new tab) 📰

Streaming on the Web (opens in a new tab) 📰

Get it done (opens in a new tab) 📰


Challenge

Javascript is always an interesting language to show us to it's skills. Some of those skills can be good, bad, ugly. Let's see without running this code piece if you can figure out what will be logged.

let sharedVariable = "initial";
 
setTimeout(() => {
  sharedVariable = "updated by first timeout";
}, 500);
 
setTimeout(() => {
  if (sharedVariable === "initial") {
    console.log("Shared variable not yet updated");
  } else {
    console.log("Shared variable was already updated");
  }
}, 500);

Answer

The answer is "Shared variable was already updated" but that does not mean this will be always true. Because JavaScript puts the setTimeout function on an event loop first setTimeout will be called out first. So if you swap the orders of setTimeout you will receive "Shared variable not yet updated". So be careful while playing with this.

Çeviri henüz hazırlanmadı, katkı sağlamak isterseniz (GitHub)[https://github.com/Ketcap/Ketcap-Dev/issues/5 (opens in a new tab)]