Format the reputation You probably do know that the different reputation levels on Stack Exchange are formatted differently when seen from the questions page / a post. There're all the rep-formatting rules:


if a user has 1 to 999 (one to three digits) rep, it's left as-is.
if a user has 1000 to 9999 rep (four digits), it receives the comma as a separator: 9,999
if a user has 10000 to 99999 rep (five digits), it's shortened and rounded. I.e., 16741 rep is formatted as 16.7k, notice the dot separator unlike the comma for the lower rep (previous point).


16750 will already result 16.8k (since this seems to be fixed)
16941 results in 16.9k, 16950 rounds up to 17k, as well as does 17014, for example.
99941 rounds to 99.9k, 99950 rounds to 100k (this is something I actually hate with the rep-rounding on SE, because 100,000 is such a milestone, and 99950 is nowhere near).

If a user has 100000 to 999999 rep, it's rounded this way:


100100 rounds down to 100k, 100500 rounds up to 101k. The thing is, the rounding is done, but the decimal part is stripped (unlike the four-digits rep).
100450 rounds down to 100k, no step to round 450 to 500. Nor does 100499 - it's still 100k.
279843 rounds up to 280k, and 399999 rounds to 400k.



As input, you're given the raw reputation, and output it as formatted.

You can consider that input won't receive any invalid numbers / non-numbers, or numbers with leading zeros, i.e. 0001234.

Because Jon Skeet doesn't seem to be reaching 1,000,000 soon, your code must be as short as possible you don't need to handle the rep greater than one million (i.e. no special cases for 999500 and above).
JavaScript (ES6), 76 68 bytes
x=&gt;x&lt;1e4?x.toLocaleString():(x&lt;1e5?(x/1e2+.5|0)/10:(x/1e3+.5|0))+&quot;k&quot;

Another first attempt. Thank goodness for that handy .toLocaleString(), the shortest alternative I could find is 21 bytes longer...
This separates thousands by either , or ., depending on what country you live in. For five two bytes more, you can make it always use a comma:
x=&gt;x&lt;1e4?x.toLocaleString`en`:(x&lt;1e5?(x/1e2+.5|0)/10:(x/1e3+.5|0))+&quot;k&quot;