Note that the array is reversed in place, and no copy is made. If the source array is sparse, the empty slots’ corresponding new indices are deleted and also become empty slots. It only expects the this value to have a length property and integer-reverse flow smoker properties.
Although strings are also array-like, this method is not suitable to be applied on them, as strings are immutable. Reversing the elements in an array The following example creates an array items, containing three elements, then reverses the array. Empty slots are copied over to their respective new indices as empty slots. Found a content problem with this page?
This page was last modified on Dec 13, 2022 by MDN contributors. Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation. Content available under a Creative Commons license. To save this word, you’ll need to log in. Can you say the alphabet in reverse order? The drug is used to lower blood pressure but may have the reverse effect in some patients.