Skip to content

Instantly share code, notes, and snippets.

@mackenco
Forked from anonymous/index.html
Created May 1, 2017 14:49
Show Gist options
  • Save mackenco/6a40282a93efad91f92f9b541fba8575 to your computer and use it in GitHub Desktop.
Save mackenco/6a40282a93efad91f92f9b541fba8575 to your computer and use it in GitHub Desktop.
Exported from Popcode.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
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