I have had a very productive weekend so far (and it’s only Saturday!). I am spending some of my day today going back through my easy Coderbyte solutions and cleaning most of them up. I will also be adding in comments for most of the lines explaining my logic. So a lot of the files will look like this:

 function FirstReverse(str) { 
   return str.split("")  //splits the string into an array of characters 
             .reverse()  //reverses the array 
             .join("");  //joins the array back into a string, with no space between the characters 

This is actually a lot of fun for me. Now that we’re getting into more abstract concepts like MVCs and servers it’s nice to just go back and power through some JavaScript code and understand exactly what it’s doing.

As always, you can find my coderbyte solutions on GitHub (I will be posting updates to it throughout the day), but I feel like I need to start adding a caveat, because of the amount of people who have said they found my blog looking for coderbyte solutions. Just staring at my code isn’t going to make you understand JavaScript. You need to do it for yourself. If you’re brand new to JavaScript, just seeing the cool tricks is not going to make you a programmer. I really recommend things like Udacity, Codecademy and other sites that talk about the fundamentals of comp sci/programming.

  • hey! was wondering for your longest word code, is there anyway you cant just do this following code casue I dont know why the .replace() is useful for this. Also (on a side note) I’d like to say I have enjoyed reading your blog and getting some feedback on how you are enjoying HR since I am interviewing myself.

    function LongestWord(sen) {

    var words = sen.split(/[^A-Za-z]/); //split by non letters
    .sort(function(a,b) {return b.length-a.length}); //sort by length any equal lengths will keep the correct order for return

    return words.shift();


Comments are closed.