Skip to content

Instantly share code, notes, and snippets.

@codergautam
Created October 24, 2021 15:36
Show Gist options
  • Save codergautam/b907e3250d9e24a6a73a529324bf62ea to your computer and use it in GitHub Desktop.
Save codergautam/b907e3250d9e24a6a73a529324bf62ea to your computer and use it in GitHub Desktop.
Easily convert between to types of numbers!
/*
num = val
newNum = ?
convert(2, 10, 4) //20
convert(5, 10, 50) //100
*/
const convert = (num, val, newNum) => (newNum * val) / num
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment