
Hello, checkiomates🐱👤!
In today's digest we offer you to understand Promises from the basics and solve intresting math puzzle with coordinates.
💡TIP
At your profile, after clicking on big percent number of your progress, you may see module and methods you have already used in your shared solutions. If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!
🏁MISSION
Count Squares by freeman_lex -
Given a sequence of points (coordinates x, y as nonnegative integers), your function should count how many squares exist so that all four corners are members of points. Note that these squares are not required to be axis-aligned so that their sides would have to be either horizontal and vertical. For example, the points [0, 3], [3, 0], [6, 3], [3, 6] define a square, even if it may happen to look like a lozenge from our axis-aligned vantage point.
assert.strictEqual( countSquares([ [0, 0], [1, 0], [0, 1], [1, 1], ]), 1 ); assert.strictEqual( countSquares([ [0, 0], [1, 0], [2, 0], [0, 1], [1, 1], [2, 1], [0, 2], [1, 2], [2, 2], ]), 6 );
📖ARTICLE
In order to truly understand promises, a fundamental part of modern JS development, we need “a surprisingly deep understanding of how JavaScript works and what its limitations are”. Luckily, this tutorial covers all the critical context you need.
👩💻CODE SHOT
How do you think, what the following code does?
function ?????????(line1: string, line2: string): string { let arr1 = line1.split(',') let arr2 = line2.split(',') return arr1.filter(str => arr2.includes(str)).sort().join(',') }
🙌 Thanks for your attention! Hope to meet you at CheckiO, as well as at our Instagram and Twitter! We are really interested in your thoughts! Please, leave a comment below! ⤵