-
Learn New Sets Methods And Split Digits Into Encreasing Ladder!
![](https://dk1vwk12q8pjl.cloudfront.net/media/blog/share/111_4.png)
Hello, checkiomates🐱👤!
Operations with sets are now a peace of cake! Read about it and try our new mission with string and number progression!
💡TIP
If you find an interesting solution, you may add it to your bookmarks by clicking the flag near solution title. You can find all your bookmarked solutions by clicking your nickame and then "Bookmarks". If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!
🏁MISSION
Beat The Previous by freeman_lex -
Given a string of digits guaranteed to only contain ordinary integer digit characters 0 to 9, create and return the array of increasing integers acquired from reading these digits in order from left to right. The first integer in the result list is made up from the first digit of the string. After that, each element is an integer that consists of as many following consecutive digits as are needed to make that integer strictly larger than the previous integer. The leftover digits at the end of the digit string that do not form a sufficiently large integer are ignored.
assert.deepStrictEqual(beatPrevious("600005"), [6]); assert.deepStrictEqual(beatPrevious("6000050"), [6, 50]); assert.deepStrictEqual(beatPrevious("045349"), [0, 4, 5, 34]);
📖ARTICLE
This article is a good read for people who are new to Set in JavaScript and are looking to find out how to use these new JavaScript methods. I'll highlight some advantages of using these methods with basic examples to show why you might reach for these instead of building your own implementations.
👩💻CODE SHOT
How do you think, what the following code does?
function ???????(data: number[]): number { const mid = Math.floor(data.length / 2); data.sort((a, b) => a - b); return (data.at(mid) + data.at(~mid)) / 2; }
🙌 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! ⤵
Welcome to CheckiO - games for coders where you can improve your codings skills.
The main idea behind these games is to give you the opportunity to learn by exchanging experience with the rest of the community. Every day we are trying to find interesting solutions for you to help you become a better coder.
Join the Game