JavaScript Cardio [Session 1] – Reversals, FizzBuzz, MaxChar



Intermediate whiteboard style JavaScript challenges and solutions to sharpen your skills and prepare you for interviews.

In this video we will do 6 challenges…

1. String Reversal
2. Validate Palindromes
3. Integer Reversal
4. Capitalize Letters
5. Find The Max Character
6. FizzBuzz Challenge

SPONSOR:
Check out Coding Dojo – http://www.codingdojo.com/l/yt/tr

CODE: Feel free to make a pull request and add other solutions
https://github.com/bradtraversy/javascript_cardio

💖 BECOME A PATRON: Show support & get perks!
http://www.patreon.com/traversymedia

VISIT MY WEBISTE: Check Out My Udemy Courses
http://www.traversymedia.com

FOLLOW TRAVERSY MEDIA:
http://www.facebook.com/traversymedia

http://www.instagram.com/traversymedia
https://discord.gg/developers

32 thoughts on “JavaScript Cardio [Session 1] – Reversals, FizzBuzz, MaxChar

  1. If anyone has any interesting solutions, feel free to make a pull request to the repo in the description. This can be a community thing. Just keep the files neat and make sure it is not something that is already there. Same with any other videos/challenges we do in this series.

  2. For reverseInt, I came up with:
    const reverseInt = (int) => {

    let newStr = int.toString();

    return parseInt(newStr.split('').reverse().join('')) * Math.sign(int);

    };
    reverseInt(-6502);

  3. I’m currently in a coding boot camp. We do coding exercises every morning and I suck at them. I’ve been looking everywhere, reading online trying to figure it out. These JavaScript cardio sessions are exactly what I’ve been looking for. Really appreciate this Brad.

  4. You can also check for a palindrome in one line, although I like your solution better:
    return Array.from(str).every(char => char === str[str.length – (str.indexOf(char) + 1)])

  5. for number 4 i did:

    const capitalizeLetters = (str) =>

    str.toLowerCase()

    .split(' ')

    .reduce((revStr, char) => revStr + char[0].toUpperCase() + char.slice(1) + ' ', '')

    console.log(capitalizeLetters('this is a teSt'));

  6. Brad:
    Thank you for providing young developers with these tutorials. Your method of teaching is very precise and knowledgeable. I have learned so much watching your videos on coding and web development. Again, thank you for all that you do.

  7. Hey thank you for the video , i also made another amateur way of getting the capital letter of the first letter

    function capitaliseLet (str){

    str = str.split('');

    let keep = str[0].toUpperCase();

    str.shift();

    keep += str.join('');

    return keep;

    }

    console.log(capitaliseLet('animals'));

  8. I haven't been able to solve maxChar for cases where there are an an equal number of characters in the string that appear the most. For example, in 'Good-day', 'd' and 'o' appear the same number of times. How can we make the maxChar function return an array containing ALL of the characters that appear the most? This is surely something that would come up during an interview.

  9. Hey fellow programmers, I'm trying to reach out to other javascript developers that are been working with javascript for awhile or currently working in the industry… I have been working on Transversy Media whiteboard videos for a good week now and working with the js for a few months now… but I still feel that I'm barely floating above water learning the language and being able to pull what methods to use when to use a variable, or conditional/for loops in a function… so if there is anyone out there please tell me it gets easier and the approach I'm going about things is the right way!.

  10. that maxCharacter one xD drove me a bit crazy. I kinda had it figured but then I was applying objects on array which held the letter and the amount of reps and it was getting really long so I looked for different ways xD. it took me a bit!!!

Leave a Reply

Your email address will not be published. Required fields are marked *