Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.
/ webgm Public archive
forked from luizzeroxis/webgm

Commit da5b34d

Browse files
committed
Fixed median function
1 parent b65dd0d commit da5b34d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/game/BuiltInFunctions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export default class BuiltInFunctions {
260260
args: [{type: "real", infinite: true}],
261261
func: function([...vals]) {
262262
if (vals.length == 0) return 0;
263-
vals.sort();
263+
vals.sort((a, b) => a - b);
264264
if (vals.length % 2 != 0) {
265265
return vals[(vals.length-1) / 2];
266266
} else {

0 commit comments

Comments
 (0)