Javascript Capitalize First Letter in Every Word Problem

In this problem, I am taking in a string and capitalizing the first letter of every word.  Here I use a for…of loop.  First I use the split() method to convert the string into an array and take the first letter of every word and capitalize it.  Then I use the slice() method to add […]

Javascript Regular Expressions (regexp)

Javascript regular expressions (regexp) are very useful methods for string manipulation — match, replace, search and split.  I also find them pretty confusing.  In the previous post on the Javascript anagram problem, I used the following regexp to remove all punctuation, etc. from a string: str.replace(/[^\w]/g,”).  What does this actually mean?  It’s hard to decipher a […]

Javascript Anagram Problem

This is the anagram problem I reviewed using Stephen Grider’s interview prep on Udemy. Amagram: a word, phrase or name formed by rearranging the letters of another, such as cinema from iceman (Google Dictionary). The challenge is to compare two sets of words or phrases to see if they contain the same number of each letter. Option 1 – […]

Javascript Chunking Problem

I worked this problem a couple of ways from both Stephen Grider’s Udemy Course and Traversy Media’s YouTube course. Below is solution 1.  I use a for…of loop.  First I determine what position the last element of the array would be (const last = chunked[chunked.length-1]).  I have to use chunked.length-1, because length counts the number […]

Javascript Reversed Integer Problem

Doing the Javascript reversed integer problem is pretty straightforward after doing the reversed string problem.  The only extra steps are to convert the number into a string “.toString()”, then an array “.split(”) and “.reverse()” to reverse it.  Finally, I need to use “.join(”) to convert it from an array back into a string, and “parseInt()” to […]

More Solutions to Javascript Reverse String Problem

I just started the Udemy course “The Coding Interview Bootcamp” by Stephen Grider.  I have five solutions below for the reverse string problem in Javascript.  The first three solutions I was already comfortable with.  I never actually used the for…of loop, however.  Grider recommends using it when possible in interviews as there is less room for […]