mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +01:00
Merge pull request #2775 from dwRchyngqxs/script_nan_fix
Fixed array comparison handling of NaN
This commit is contained in:
commit
44a6f1b5a8
@ -20,7 +20,8 @@ export function compareArrays<T>(a1: T[], a2: T[]): boolean {
|
|||||||
if (!compareArrays(elem1, elem2)) {
|
if (!compareArrays(elem1, elem2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (a1[i] !== a2[i]) {
|
} else if (a1[i] !== a2[i] && !(Number.isNaN(a1[i]) && Number.isNaN(a2[i]))) {
|
||||||
|
// strict (in)equality considers NaN not equal to itself
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user