Skip to content

Instantly share code, notes, and snippets.

@vilellaj
Last active January 16, 2017 19:23
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 vilellaj/c65cbab51d898a2047754011ed809981 to your computer and use it in GitHub Desktop.
Save vilellaj/c65cbab51d898a2047754011ed809981 to your computer and use it in GitHub Desktop.
Given a number, divide it in equal parts respecting a limit, returning the value of a part.
divideInEqualParts(value, limit)
{
let result = (value / 2);
return (result > limit ? divideInEqualParts(result, limit) : result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment