Created
May 1, 2017 14:49
-
-
Save anonymous/bfb2e9abfd7698f2ce55b8e988c2854c to your computer and use it in GitHub Desktop.
Exported from Popcode.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Page Title</title> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bar = 45; | |
const plates = [45, 25, 10, 5, 2.5]; | |
let out = []; | |
function makeWeight(total) { | |
let side = (total - bar) / 2; | |
plates.forEach((plate) => { | |
while (side - plate >= 0) { | |
out.push(plate); | |
side -= plate; | |
} | |
}); | |
console.log(out); | |
} | |
makeWeight(175); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment