-
Don't Be Afraid Of Function Composition And Try To Use It In A New Mission!
Hello, checkiomates🐱👤!
In this digest we offer to read a well explained article about function composition and try to solve a new fucnction about calculating working time.
💡TIP
You may click on any mission tag and see all missions, where this tag is present! If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!
🏁MISSION
Working Hours Calculator by freeman_lex -
Write a function that takes two dates and two times as input and returns the total number of working hours between the two dates (incl. both). Times representing the start and end of a workday. Working hours are defined as the time between the end and start times, Monday through Friday, excluding holidays. So the function also takes an argument that specifies an array of holidays to exclude (could be empty). Time may have minutes. Convert them into float as minutes/60 with two-digits precision.
assert.strictEqual(workingHours("2023-03-01", "2023-03-01", "09:00", "17:00", []), 8); assert.strictEqual(workingHours("2023-03-01", "2023-03-02", "09:00", "17:00", []), 16); assert.strictEqual(workingHours("2023-03-01", "2023-03-03", "09:00", "17:00", ["2023-03-01"]), 16);
📖ARTICLE
JS function composition: what's the big deal? -
To hear some people talk, you’d think function composition was some kind of sacred truth. A holy principle to meditate upon whilst genuflecting and lighting incense. But function composition is not complicated. You probably use it all the time, whether you realise it or not. Why, then, do functional programmers get all worked up about it? What’s the big deal?
👩💻CODE SHOT
How do you think, what the following code does?
var ???????? = t => t.toUpperCase() == t || (t = t.slice(1), t.toLowerCase() == t)
🙌 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