Day 15: These Are All The Tabs It Took Me To Learn About Array / Object References

All the tabs I had to open to best the Palindromes challenge! O.O

All the tabs I had to open to best the Palindromes challenge! O.O

Holy cow. It took me over two hours to figure out that: 

var arrayForward = stringNoCaps.split('');

var arrayBackward = arrayForward.reverse();

Is going to modify both arrays, because the second is just a reference to the original O.O The solution was in Array.prototype.slice:

var arrayBackward = Array.prototype.slice.call(arrayForward).reverse();

That challenge was something else! Learned a lot from it.

Today's Log and Notes:

Time Coding: 2 hours 20 mins.

Pushups: 27

Update:

I bounced my solution off of the lead developer at my company and he gave me a much more elegant solution. Figures ;p

function isPalindrome(s) {
  var filtered = s.replace(/[^a-z0-9]/g, '');
  return filtered === filtered.split('').reverse().join('');
}