Working with Big Numbers in JavaScript

Need to work with a really big number in JavaScript? Larger than a normal int? BigInt is your answer!

Say, for example, you were trying to solve the “A Very Big Sum” problem on HackerRank. The code is simple with BigInt():

function aVeryBigSum(ar) {
    // Write your code here
    let sum = 0n;

    for (let i = 0; i < ar.length; i++) {
        sum = sum + BigInt(ar[i]);
    }
    return sum;
}

You can find detail on Mozilla and W3docs.

Displaying a Caption on a Featured Image in WordPress

Some themes in WordPress do not display the caption on the Featured Image.

This can be easily added with the FSM Custom Featured Image Caption plugin.

Continue reading “Displaying a Caption on a Featured Image in WordPress”