mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +01:00
Fixed array comparison handling of NaN
Issue #2033 is fixed, not using Object.is as recommended by https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#when_to_use_object.is_versus_triple_equals
This commit is contained in:
parent
07fe3c1906
commit
08314ed33e
@ -20,7 +20,8 @@ export function compareArrays<T>(a1: T[], a2: T[]): boolean {
|
||||
if (!compareArrays(elem1, elem2)) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user