Skip to content
Advertisement

Tag: reverse

Array Reverse is not working for me …

Consider the following code (React JS code): Notice the console.log. Lets see an image: Last I checked, reverse should have reversed the order of the array. Yet it doesn’t. Am I Using this wrong (official MDN Docs)? Why isn’t reverse working? Answer As described at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse, reverse() reverses the order of an array in place, so the array is reversed

Advertisement