Skip to content

Instantly share code, notes, and snippets.

View BusinessDuck's full-sized avatar
🦆

Dmitriy Yurov BusinessDuck

🦆
View GitHub Profile
/* eslint-disable no-console */
const crypto = require('crypto');
/**
* Modulus operation with a twist. It takes two parameters, a and b, and returns the remainder
* of the division of a by b. However, there's a condition to handle the case when a is negative.
*/
function mod(a, b) {
return ((a % b) + b) % b;
}