JavaScript: How to compare elements in an array?

I. Palindrome

function palindrome(string) {
return string == string.split("").reverse().join("")
}
// outputs a boolean due to the "==" operator
let i = 0while ( i < array.length ) {
// code logic
}

II. Sort

Conclusion

Related Links

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store