We want to continue helping the community and we have a new initiative, but we need your help!
In JsTips Bites we are going to share with you what the team reads, view and listen during the week, summarized with high quality, no ads and with a challenge at the end to make you think smarter 🤯.
We are reading 👀
Want a good explanation of Async and Await? You can have here with good examples. Async/await is a new way to write asynchronous code. It is built on top of promises, thus, it is also non-blocking. The big difference is that asynchronous code looks and behaves a little more like synchronous code. Don’t want to read? Check this video.
An epic recompilation of algorithms and data structures, each one with explanations and links to further readings. If you are looking an excuse to spend your weekend on your computer, take a look here!
A new Node.js version is coming - October 2019 is the planned release date - and the head of the team explains the new features: modules support, threads, private variables and more. Big claps 💪🏼 for the Node.js team.
According to metrics, 40% of visitors will leave your site if the loading takes more than 3 seconds. In this article, Liz wrote about 14 ways to improve your application performance.
We are listening 🎧
David and the podcast panel discusses what a state is in React, he defines it as a state machine and presents his library called Xstate. They also talk about the importance of learning from other industries, Waterfall versus the Agile mindset and finished sharing thoughts about the industry standards.
alert(‘The thread of the week 🎣’);
A last bite 🥽
Fractal Animations: Create awesome fractals with this tutorial.
Jimp: An image processing library with zero external or native dependencies.
Framer Motion: An open source React library to power production-ready animations.
Challenge of the week 🕵️♀️ by @rincodes
A prison can be represented as an array of cells. Each cell contains exactly one prisoner. A 1 represents an unlocked cell and a
0 represents a locked cell.
[1, 1, 0, 0, 0, 1, 0]
Starting from the leftmost cell, you are tasked with seeing how many prisoners you can set free, with a catch. Each time you free a prisoner, the locked cells become unlocked, and the unlocked cells become locked again.
So, if we use the example above:
[1, 1, 0, 0, 0, 1, 0] // You free the prisoner in the 1st cell.
[0, 0, 1, 1, 1, 0, 1] // You free the prisoner in the 3rd cell (2nd one locked).
[1, 1, 0, 0, 0, 1, 0] // You free the prisoner in the 6th cell (3rd, 4th and 5th locked).
[0, 0, 1, 1, 1, 0, 1] // You free the prisoner in the 7th cell - and you are done!
Here, we have freed
4 prisoners in total.
Create a function that, given this unique prison arrangement, returns the number of freed prisoners.
freedPrisoners([1, 1, 0, 0, 0, 1, 0]) ➞ 4
freedPrisoners([1, 1, 1]) ➞ 1
freedPrisoners([0, 0, 0]) ➞ 0
freedPrisoners([0, 1, 1, 1]) ➞ 0
Post your answer here and join the discussion about what is the best solution.
You are going to solve the challenge faster with this playlist 🎧
How did you like today’s email?