Post image
JavaScript Deep Dive: Trends, Fractions, and Performance

Hello, checkiomates🐱‍👤!

In this edition, we uncover the latest trends shaping JavaScript from the State of JS 2024 report, explore how to handle fractional numbers accurately in JavaScript, and discover tips for writing fast and memory-efficient code. Plus, challenge yourself with a mission to determine whether a number is a perfect power—testing both your math and JavaScript skills.

💡TIP

At every mission page, under the editor window, there is a terminal window.
If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!

🏁MISSION

Checking Perfect Power by freeman_lex -

A positive integer n is a perfect power if it can be expressed as the power be for some two integers b and e that are both greater than one. (Any positive integer n can always be expressed as the trivial power n1, so we don’t care about those.) For example, the integers 32, 125 and 441 are perfect powers since they equal 25, 53 and 212, respectively.
This function should determine whether the positive integer n is a perfect power. Your function needs to somehow iterate through a sufficient number of possible combinations of b and e that could work, returning true right away when you find some b and e that satisfy be == n, and returning false when all relevant possibilities for b and e have been tried and found wanting.
Since n can get pretty large, your function should not examine too many combinations above and beyond those that are both necessary and sufficient to reliably determine the answer. Achieving this efficiency is the central educational point of this problem.

assert.strictEqual(perfectPower(8), true);
assert.strictEqual(perfectPower(42), false);
assert.strictEqual(perfectPower(441), true);

📖ARTICLE

State of JavaScript 2024 -

Each year, Devographics runs a popular survey to see what JS features and tools you know about, use, and love/hate. It’s structured such that you can learn something just from taking it and the results are always interesting.

Precise Decimal Math in JavaScript with Fraction.js -

How to handle exact decimal calculations in JavaScript when floating-point precision isn't good enough.

How To Write Fast Memory-Efficient JavaScript -

In today’s fast-paced digital world, performance is crucial. Whether building a complex web application or a simple website, fast Memory-Efficient JavaScript can significantly enhance the user experience. This blog post will guide you through best practices and techniques for writing fast, memory-efficient JavaScript.

👩‍💻CODE SHOT

How do you think, what the following code does?

function ??????????(items: number[]): number[] {
    return items.filter(v => v).concat(items.filter(v => !v));
}

🙌 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! ⤵

Created: Dec. 17, 2024, 7:51 p.m.
0
16
User avatar
freeman_lex