mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-13 02:44:39 +08:00
added get number suffic
This commit is contained in:
parent
08aab5b0dc
commit
8cf356ee29
1 changed files with 15 additions and 0 deletions
|
|
@ -346,6 +346,21 @@ export function roundTo2(num) {
|
|||
return Math.round((num + Number.EPSILON) * 100) / 100;
|
||||
}
|
||||
|
||||
export function getNumberSuffix(num) {
|
||||
var j = num % 10,
|
||||
k = num % 100;
|
||||
if (j == 1 && k != 11) {
|
||||
return "st";
|
||||
}
|
||||
if (j == 2 && k != 12) {
|
||||
return "nd";
|
||||
}
|
||||
if (j == 3 && k != 13) {
|
||||
return "rd";
|
||||
}
|
||||
return "th";
|
||||
}
|
||||
|
||||
export function findLineByLeastSquares(values_y) {
|
||||
var sum_x = 0;
|
||||
var sum_y = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue