Good old palindrome in javascript.
Go to solution
Solved by jincio,
So, yeah, you can't compare Arrays. That's why you usually use library like Lodash for doing such thing. For the last case on other hand, you are initializing a new empty object
let new_string = {};
so when you try to add a string to an object javascript try to convert everything to a string and for that use the method `.toString()` on the obejct, which result in [object Object]. For making the last example work you need to initialize the new object as a new empty string
let new_string = "";
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now