Skip to content
Advertisement

Tag: math

Generate random 6 characters based on input

Generate random 6 characters based on input. Like I want to turn 1028797107357892628 into j4w8p. Or 102879708974181177 into lg36k but I want it to be consistant. Like whenever I feed 1028797107357892628 in, it should always spit out j4w8p. Is this possible? (Without a database if possible.) I know how to generate random 6 characters but I dont know how to

Only half of array gets raised to power

I wanted to create binary to decimal calculator. When i tried to console log both of arrays (binary is array of 0’s and 1’s, binarypos is array of numbers that are powers of 2. Screenshot Then i created simpler version, made in console so chance of making a mistake lowered to zero. But the bug appears again! I want it

Percetange calculation wrong result

I want to calculate the percentage of a minute from a given number of hours. So let’s say I have 2 hours. That’s 2*60 minutes. And I want to know how much percent does 1 minute take from 2 hours. The value should be 0.833, because 0.833 * (2*60) = 100%. But how do I get this 0.833 number? (hours

Convert 45 to 1 and 345 to 2 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 7 months ago. Improve this question I’m building a carousel with a swiping limit exceeding both left and right of 45px on each item has 300px width I wonder How to

MYR Currency Rounding

Looking for help in rounding the money to the nearest 0.05 in js language. Input & Expected Output: From: https://www.bnm.gov.my/misc/-/asset_publisher/2BOPbOBfILtL/content/frequently-asked-questions-faqs-on-rounding-mechanism Answer You could take an offset and take a multiple floored value. If you need zeroes at the end take .toFixed(2).

Advertisement