Last active
September 22, 2018 19:41
-
-
Save fkfk/d7be7d0bc24aa90276a7e534251cbec1 to your computer and use it in GitHub Desktop.
Safari 12 Array.prototype.reverse bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fn = () => { | |
let array = [1, 2, 3, 4, 5] | |
console.log(array) | |
array.reverse() | |
} | |
fn() // => [1, 2, 3, 4, 5] | |
fn() // I expect to be `[1, 2, 3, 4, 5]`, but in the case of Safari 12 it will be `[5, 4, 3, 2, 1]` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fn = (array) => { | |
console.log(array) | |
array.reverse() | |
} | |
fn([1, 2, 3, 4, 5]) // => [1, 2, 3, 4, 5] | |
fn([1, 2, 3, 4, 5]) // I expect to be `[1, 2, 3, 4, 5]`, but in the case of Safari 12 it will be `[5, 4, 3, 2, 1]` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment