def to_weird_case(s) s.split(' ').map { @1.chars.map.with_index { @2.even? ? @1.upcase : @1.downcase }.join }.join(' ') end
Ah I tried map_with_index but that's not a method. Did not know there was a .map.with_index!
map_with_index
.map.with_index
I'm glad to hear that. Enumerable has so many methods, which is useful but I take a little bit time to remember them.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ah I tried
map_with_index
but that's not a method. Did not know there was a.map.with_index
!I'm glad to hear that. Enumerable has so many methods, which is useful but I take a little bit time to remember them.