Skip to content

Instantly share code, notes, and snippets.

@gko
Last active January 19, 2023 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gko/c293c92e8a7c62da4270741147df0355 to your computer and use it in GitHub Desktop.
Save gko/c293c92e8a7c62da4270741147df0355 to your computer and use it in GitHub Desktop.
const getPercentageRounds = function(percentage = 1) {
const blueSpotSymbol = "🔵";
const emptySpotSymbol = "⚪";
// 1 to 10
const convertedPercent = Math.ceil(percentage * 10);
const blueSpots = Array(convertedPercent).fill(blueSpotSymbol);
const emptySpots = Array(10 - convertedPercent).fill(emptySpotSymbol);
return [...blueSpots, ...emptySpots].join('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment