Created
March 23, 2014 16:41
-
-
Save hrosenbauer/9725754 to your computer and use it in GitHub Desktop.
be more descriptive about numbers
This file contains hidden or 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
| function aLot(n, one, two, many) { | |
| var s = n === 1 ? one : (n === 2 ? two : many); | |
| return s.replace(/\{\}/g, n); | |
| } | |
| aLot(1, 'one link', 'two links', 'countless links ({})'); | |
| aLot(2, 'one link', 'two links', 'countless links ({})'); | |
| aLot(99, 'one link', 'two links', 'countless links ({})'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment