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

  Рет қаралды 171,639

Traversy Media

Traversy Media

Күн бұрын

Пікірлер: 335
@TraversyMedia
@TraversyMedia 6 жыл бұрын
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.
@TheBeater0
@TheBeater0 6 жыл бұрын
At Lession 2 could you make again Challange 5 ? With some better describe then this one? :P I dont really get that :( And with other solution (i dont get only this challange 5)
@adrianomachado5629
@adrianomachado5629 6 жыл бұрын
Brad, greetings from Brazil! Excelente ideia to keep our skills sharp! And we did it, more than 1k likes! Please, provide more videos like that! best regards
@syedmuhammadwaleed709
@syedmuhammadwaleed709 6 жыл бұрын
sir will U please guide do I really need a degree to get into tech industry although sit I learn a lot from your youtube channel
@DennisAlvey
@DennisAlvey 6 жыл бұрын
Any chance you can go through the logic of these? discuss the how and why?
@peterborinski
@peterborinski 6 жыл бұрын
for(var i = 0; i < arr.length/2; i++){ [arr[i], arr[arr.length - 1 - i]] = [arr[arr.length - 1 - i], arr[i]] } return arr; Is also neat to reverse strings :) I don't know how to do pull requests, but you can mabye add this.
@hassankaafiomar
@hassankaafiomar 6 жыл бұрын
Thanks Brad You're my hero man Giving all these tutorials without paying it wooow guys support this guy he's a LEGEND
@abdallahrizk8787
@abdallahrizk8787 5 жыл бұрын
dude you are the best. I used to be a student in a bachelor of software engineering for 3 years and its waste of time if I only knew you before.
@m4gs.
@m4gs. 3 жыл бұрын
I did your entire MERN stack course on Udemy and got everything I needed to get a job as a React developer. First job I tried (React Software Engineer) What I was expecting in the application test: React stuff What they asked: "Umm... can you like mess with this string in this specific way you've never seen before just for fun?" I failed. I learned the lesson. I'm taking javascript cardio sessions now. Thank's Brad for saving me again lol.
@StackMentor
@StackMentor Жыл бұрын
thanks Brad please you can do more of this
@willc6720
@willc6720 5 жыл бұрын
Brad - Your stuff is fantastic. You are the TOP, most knowledgeable programmer on the internet - Bar none. I'm finishing up your PHP - Front to Back series right now, going to do your PHP & Stripe API project - bought your MERN stack course on Udemy. I'm your new #1 fan. Of anyone I've ever seen code, you know your shit down to the core. Thanks for your videos man, you rock!!
@harismalik9706
@harismalik9706 4 жыл бұрын
at 28:00 when he is using a regular expression ,when we use a capitalized string its title doesnt change to upper case so in order to do that use a str.toLowerCase().replace .
@DivineJesusPrayers
@DivineJesusPrayers 6 жыл бұрын
Brad, you are truly a blessing to the learning community in this channel of yours. Your passion to teach and see your students succeed is unprecedented. You give above and beyond what one would normally term as 'free content'. I love this content, the name is just awesome, the tutorial is pure gold! Please release more of such series in future as time permits you. From the deepest recess of my heart, I am most grateful sir.
@prabhjotsingh3329
@prabhjotsingh3329 5 жыл бұрын
Thanks Brad for the practice sessions. Please keep making videos like these. Reverse the string with Recursion function revStr(str){ if(str.length ===0){ return "" } else{ return str[str.length - 1] + revStr(str.slice(0,str.length - 1)) } } let str = "hello" console.log(revStr(str))
@MrRuchir23
@MrRuchir23 6 жыл бұрын
JavaScript Cardio ... What a innovative heading ... Thinking of doing cardio for many days but never get motivated , But I really want to do this cardio everyday..... Please continue with this series....
@michaeltruss5833
@michaeltruss5833 4 жыл бұрын
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.
@DucaTech
@DucaTech 6 жыл бұрын
For challenge 3: Reverse Int you can use the ? conditional operator in case the interviewer does not allow you to use the Math class or any other higher level objects. For instance: return parseInt(revString) * (int < 0 ? -1 : 1); For CHALLENGE 6: FizzBuzz, you can use the ! operator instead of the === operator. For example: for (let i = 0; i
@continental_drift
@continental_drift 6 жыл бұрын
It's always good to see other peoples solutions to problems, if they are different then you learn something. Sometimes looking at other peoples solutions can give you insight into how to make your own solutions better.
@DevBranch
@DevBranch 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.
@AmarKumar-lv1wu
@AmarKumar-lv1wu 6 жыл бұрын
Hey Brad Thanks for this stuff you are the reason for me to not give up while learning programming because solving problem always make me suck really you are the legend of this industry in my opinion i came long way only because of you i had started watching your content last year of december and at that time i was ZERO and now i feel that i'm ready to land my first job as a MERN STACK DEVELOPER within in one month its not enough if i return you something after getting job but i'll return you something with thanks message for making my career and for becoming my mentor as i call in indian language you are my (GURU) Thank You so much Brad God bless you.
@krittatwizted6439
@krittatwizted6439 6 жыл бұрын
This!! This is what I needed to sharpen the skills I have been learning!
@sida9908
@sida9908 5 жыл бұрын
I don't get it. Who are those 14 dislikes :-? This guy is one of a kind teacher in my opinion. He's an amazing code with a talent that not everyone has and that is explaining and teaching things the easy way Thank you so much for you amazing videos
@ianchin5634
@ianchin5634 6 жыл бұрын
You are the real deal, giving the audience the information they need to succeed
@marlonrettis9713
@marlonrettis9713 6 жыл бұрын
He is so elegant in his explanations. God bless you Brad! ...and thank you!
@maxtirdatov
@maxtirdatov 6 жыл бұрын
Here is a solution for isPalindrome() without using a function to reverse the string. It's also about three times faster. function isPalindrome(str) { for (let i = 0; i < (str.length / 2 | 0); i++) { if (str[i] !== str[str.length - i - 1]) return false; } return true; }
@varan22
@varan22 6 жыл бұрын
Exactly my thoughts, when I was watching a video.
@JLucRob
@JLucRob 6 жыл бұрын
Nice solution! Just for anyone wondering, the | operator is a Bitwise OR. When using a Bitwise OR with 0 as the 2nd operand, it will always yield the 1st operand, floored. So, "x | 0", is the same as "Math.floor(x)". I had to look it up ;) You can confirm this @Max Tirdatov ?
6 жыл бұрын
When there is a possibility that x is a very large number, it is better to use Math.trunc(x) function instead of x | 0. For small numbers, it does not matter. Example: Math.trunc(666666666666.6) will correctly return 666666666666, while 666666666666.6 | 0 will return 946735786. Also, for negative numbers, x | 0 acts as Math.ceil(x), that is, it rounds the number up, towards zero. For example: -6.6 | 0 === -6 Math.Floor(-6.6) === -7 Math.Trunc === -6 Math.Ceil === -6 6.6 | 0 === 6 Math.Floor(6.6) === 6 Math.Trunc === 6 Math.Ceil === 7 Hope that clears things up.
6 жыл бұрын
For reversing strings, here is a funny while loop, which totally works: function reverseString(str) { let i = str.length, output = ''; while (i --> 0) { // LOL output += str[i]; } return output; }
@brianlmosley
@brianlmosley 6 жыл бұрын
We do not deserve this! Greatest cod by Chanel out!! Thanks Brad!
@terminator_363
@terminator_363 3 жыл бұрын
for palindrome guys we can use two pointer approach , let i = 0; let j = str.length - 1; while(i
@herosamako1759
@herosamako1759 6 жыл бұрын
Thank you so much. after i learned javascript my pc became very slooow (8 years old) that made me stop for 7 months. now i have a brand new pc and needed this so much. thank u again.
@michaelrooze278
@michaelrooze278 2 жыл бұрын
You can also use reduceRight which starts from the right side return str.split('').reduceRight((acc, curr) => acc + curr)
@陈瀚龙
@陈瀚龙 6 жыл бұрын
I've studied this well, and I want to say, I'm a teacher, and either you put a shit-ton of thought into this video, or you're just a naturally great teacher. By the way, from now on, I'm calling my office "The Javacrypt".
@davehoffman9622
@davehoffman9622 6 жыл бұрын
I love the idea of doing challenges. I love following your channel Brad! Keep the good content coming.
@MistaT44
@MistaT44 6 жыл бұрын
I will be applying for jobs next semester (last) and I am very insecure about on-the-spot problem solving. This is insane! thanks traversy
@Welcometomyjourney20
@Welcometomyjourney20 6 жыл бұрын
Thanks Brad. Honestly, this is the next step to do after learning the fundamentals. Solving as much as u can js algorithms & challenges by yourself is the only way to master js coding.
@simonsmith3977
@simonsmith3977 3 жыл бұрын
Excellent Workout. Just the sort of thing i need to help with js practice. Keep them coming. Thanks
@陈瀚龙
@陈瀚龙 6 жыл бұрын
Bro, I've been praying for you to do this for so long. I've even mentioned it in the comments, and I just now saw that you've done. Badass. Thank you, so much.
@eddiegomez4134
@eddiegomez4134 6 жыл бұрын
Didn't know this what white boarding problems would be like. This are similar to the codewars problems. Thanks for this!
@Hammmmyy
@Hammmmyy 6 жыл бұрын
Dude havent watched this yet, but from the title it looks like this is just the beginning of a great practice series! Cant wait to check it out! Love that you are really helping us all learn, and learning by doing is the best way. Thanks again, and I'l leave some love when I get the chance to check out the vid
@JoeWong81
@JoeWong81 6 жыл бұрын
Thanks for these sample problems Brad. Even though these were fairly straightforward, they really help us for our interviews as well as our overall skill in general. Keep this series coming please.
@Albert-fe8jx
@Albert-fe8jx 6 жыл бұрын
The interview tech q&a is a great idea. It would be greatly enhanced by demonstrating and incorporating unit tests in these example functions. Working functions are great, but incorporated tests are better. It builds a design mindset. Thank you.
@GomPerDie
@GomPerDie 6 жыл бұрын
Brad, Please continue this series, it's a bless.
@zohra9746
@zohra9746 5 жыл бұрын
GREAT Video! I was scared to do algo's but you've really boiled it down to the boiler plate. THANKS!!
@davidsaso1234
@davidsaso1234 3 жыл бұрын
Loved it. Learnt a lot and WAS very fun. Let's try harder ones!
@maelstrom57
@maelstrom57 3 жыл бұрын
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)])
@krave96
@krave96 6 жыл бұрын
You're great! Please continue this playlist. From Russia with love and respect )
@MrDunlop707
@MrDunlop707 6 жыл бұрын
You are fantastic teacher, developer and you are truly professional. Please upload more JavaScript Cardio videos!!! Best regards!
@IdreesDargahwala47
@IdreesDargahwala47 6 жыл бұрын
Stephen Grider, a teacher, has his course on Algorthms and Data Structures on Udemy. Kind of reminds me of his videos looking at the syntax. Nevermind, knowledge is available everywhere. 🤞 Thanks Brad.
@jasperricon3231
@jasperricon3231 5 жыл бұрын
Brad, how many years have you programmed to know all these different technologies? It’s quite amazing how immense your knowledge base is. Thanks for all the videos, they are extremely helpful and great.
@retiar2111
@retiar2111 6 жыл бұрын
This is a quality video just like all other videos you make brad, however, these can be learned by reading articles. Projects on the other hand are much easier to follow along watching a video. Same goes for smaller tutorials that are under 1h and under 20 mins. I love the channel, i love your teaching method and everything!
@sirius8ly
@sirius8ly 3 жыл бұрын
For reverseInt, I came up with: const reverseInt = (int) => { let newStr = int.toString(); return parseInt(newStr.split('').reverse().join('')) * Math.sign(int); }; reverseInt(-6502);
@jasonwelsh417
@jasonwelsh417 6 жыл бұрын
I love all of your videos and this series is a very welcome and awesome idea. Thanks for all that you do! I am trying to get a job and your content is helping.
@badmuskaybee5111
@badmuskaybee5111 6 жыл бұрын
These is 100% cool. I feel like this is more useful in statit type language like C# Java and Phyton
@agboladeadeniyi8777
@agboladeadeniyi8777 6 жыл бұрын
Brad, I must commend you. you are a wonderful person. your tutorials have really helped me. thank you so much.
@ThatGuyDownInThe
@ThatGuyDownInThe 4 жыл бұрын
it's crazy, Brad is literally has thousands of apprentices like a master tradesman. This is just the new age version of that old concept.
@okonfriday6190
@okonfriday6190 2 жыл бұрын
Thanks a lot, Traversy Media, I really appreciate and love it please do more of this for like different subtopics in javascript. much love and good energy to do more
@rconr007
@rconr007 6 жыл бұрын
Thank you for providing these kinds of exercises. It's good practice for interviews.
@Shawn15690
@Shawn15690 4 жыл бұрын
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'));
@ketankshukla
@ketankshukla 6 жыл бұрын
You already got more than 1000 likes. Looking forward to this becoming a series!
@subhashgn1775
@subhashgn1775 3 жыл бұрын
Thank you for the great resource man. Very grateful to you.🙏
@tsigiekumssa7972
@tsigiekumssa7972 6 жыл бұрын
Thank you Brad! You are the best instructor.
@dean6046
@dean6046 5 жыл бұрын
Thanks so much Brad! You'll be hitting 1 million soon and are very deserving of it!
@dalecooper3994
@dalecooper3994 6 жыл бұрын
Brad, you are a wonderful person! Thanks for all your effort!
@snehashischattopadhyay9519
@snehashischattopadhyay9519 6 жыл бұрын
The exact thing that we wanted! Thank you so much Brad!
@stuknowlton477
@stuknowlton477 4 жыл бұрын
Thank you brad I would love more JavaScript Cardio Sessions!!!
@blackaccel
@blackaccel 6 жыл бұрын
Nice!!! Just what I was looking for! Some coding cardio!
@joben42
@joben42 6 жыл бұрын
Keep up the good work Brad. I’ve been struggling with many of these concepts, and this video really helped with my understanding of them. Really appreciate everything your doing on your channel!
@mostafashawki
@mostafashawki 6 жыл бұрын
Perfect, we really need more video like that, this is very very useful for job interviews. Agree? give a like.
@jdiaz6
@jdiaz6 6 жыл бұрын
More likes people!!! This is pretty good stuff... thanks Traversy
@heidik1757
@heidik1757 4 жыл бұрын
Just starting JS but this is helping me to start seeing a pattern in solving algorithms. Same thing different desired outcome. Thanks
@BobbyBundlez
@BobbyBundlez 4 жыл бұрын
how u doin with your studies? im close to starting to look for jobs. been at this a year and a half almost!
@xaviguasch
@xaviguasch 4 жыл бұрын
Amazing series, please do more Brad. I'd buy an entire course of you explaining interview questions.
@phuongta3145
@phuongta3145 5 жыл бұрын
in the challenge 5 you could pass those two maxChar and maxNum to the forEach function. It's not necessary to create another 'for' loop for this
@chamnil8666
@chamnil8666 4 жыл бұрын
You are a god among humans.Thank you sir.
@beec3694
@beec3694 6 жыл бұрын
You've officially reached 1K! I can't wait to see more videos like this. I'm learning JS now so seeing solutions and explanations to these problems are great, not to mention the multiple ways of solving the problems are awesome!
@RockstahRolln
@RockstahRolln 6 жыл бұрын
This is Brilliant! Perfect timing! I can get to practice these challenges prior to my interview(s). Many Thanks Brad!! Please do more!
@arockiamkaspar2300
@arockiamkaspar2300 6 жыл бұрын
Super Brad.Really awesome. Expect a bit more harder questions.
@devsami
@devsami 6 жыл бұрын
Just loved it.. please continue it as a series..
@mohamedabdulnazar5510
@mohamedabdulnazar5510 6 жыл бұрын
Essential video.Please make more videos on this topic.
@sayedabdulkarim7086
@sayedabdulkarim7086 5 жыл бұрын
var revInt = (n) => { var num = n.toString().split('').reverse().join(''); return n < 0 ? -1 * parseInt(num) : parseInt(num) }
@andreypm3
@andreypm3 6 жыл бұрын
Hi, Brad. I like your idea very much, but what I've missed in the implementation is the performance measurement. Just for myself I've gathered all the variations of solving one problem in separate methods of one class and then used next code: function performTests() { const rev_str_obj = new reverseString(); for (let func_name of Object.getOwnPropertyNames( reverseString.prototype )) { if (func_name == 'constructor') continue; let i = 0; console.time(func_name); while (i < 100000) { i++; output = rev_str_obj[func_name]('Lorem ipsum dolor sit amet, eirmod deleniti explicari his id, vis te posse constituto. No mel omnium nostrud, te vim possit minimum recusabo,'); } console.timeEnd(func_name); } } performTests();
@Mekan1z
@Mekan1z 3 жыл бұрын
good examples, my suggestion to simplify it to use the chrome debugger and vs code. Because in the debugger we can pause in see exact values how it changes.
@navin_kg
@navin_kg 6 жыл бұрын
hi , this is what I was looking for , thank you so much for taking my words into consideration . plz do continue a videos series like more advance programs and then data structures
@LonelyJester
@LonelyJester 4 жыл бұрын
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!!!
@pavels9566
@pavels9566 6 жыл бұрын
I would love to see more examples and solutions. Thank you, Brad.
@zastojn_golaz
@zastojn_golaz 6 жыл бұрын
This is the best thing ever, hope you do more of this kind of videos!
@MenAtWorkMedia22
@MenAtWorkMedia22 6 жыл бұрын
Thanks, Brad! These videos help greatly!
@nurudeennajeem6605
@nurudeennajeem6605 2 жыл бұрын
Thanks a lot. Please I need more of this tutorial.
@PurdyRich
@PurdyRich 6 жыл бұрын
Brad this is awesome!! This is a great idea for the channel. Thank you once again.
@lejeet3
@lejeet3 6 жыл бұрын
I really liked this video. I'd say just keep doing the future videos the same way while having the content progressively get more challenging.
@annez8598
@annez8598 6 жыл бұрын
Excellent! Looking forward to your tutorials about debugging and testing particularly for VueJS programs. Many thanks!
@gw2realm
@gw2realm 6 жыл бұрын
Great vid! Similar problems to this can be found on Codewars. Really great website couldn't recommend enough.
@petecapecod
@petecapecod 6 жыл бұрын
Oh man this is like one of THE BEST videos yet. I definitely learned new things and it helped in using the JavaScript that I already know. Great job 😎🙌
@mehdihosseinpour6337
@mehdihosseinpour6337 6 жыл бұрын
Thank you Brad, I'd like that a lot, please keep making that on.
@lucasd.1854
@lucasd.1854 5 жыл бұрын
Coding Dojo! Just graduated from there!
@M0rg1t0u
@M0rg1t0u 6 жыл бұрын
Wow what a nice idea! I'm quite proud of my solution for number5: function maxCharacter(str) { var maxChar = ' '; var maxLength = 0; for(var i = 0; i < str.length; i ++){ if(str.split(str.charAt(i)).length > maxLength){ maxLength = str.split(str.charAt(i)).length; maxChar = str.charAt(i); } } return maxChar; }
@payskin
@payskin 6 жыл бұрын
this is awesome!
@M0rg1t0u
@M0rg1t0u 6 жыл бұрын
ahah thanks
@JLucRob
@JLucRob 6 жыл бұрын
Clever ahah! For anyone wondering, I believe str.charAt(i) does the same as str[i]. I find it more readable with str[i].
@M0rg1t0u
@M0rg1t0u 6 жыл бұрын
JLucRob good to know. I thought to be able to do that you'd have to split it before
@dansintean6820
@dansintean6820 6 жыл бұрын
Higher Order Video man. Keep it up!!!
@nidhirenil1899
@nidhirenil1899 5 жыл бұрын
Too good..loved the usage of array helper functions
@pjbruce100
@pjbruce100 6 жыл бұрын
Love your videos Brad, you're a very able teacher
@highland5729
@highland5729 3 жыл бұрын
Challenge 4th is useful for title, headline news when it comes users create their content without aware of capitalize each words.
@ZeDon140
@ZeDon140 4 жыл бұрын
This is an awesome video. Thank you for sharing the great content for JS algorithms
@TechRambles
@TechRambles 6 жыл бұрын
This video came at the perfect time. I have a lot of interviews coming up. Thanks!
@OGBhyve
@OGBhyve 6 жыл бұрын
Woah! I really love your content and I love the bite-sized things you do. This definitely puts a new spin on that same great idea.
@MrVisheshsingh
@MrVisheshsingh 6 жыл бұрын
Thanks brad! We would love to see more videos of this kind so that we can polish our JS skills
@marinpericradan122
@marinpericradan122 3 жыл бұрын
Thanks a lot Brad, these videos really are great, keep up the great work =D
@ninjajs7527
@ninjajs7527 6 жыл бұрын
I would really like to see more of this sessions. Thanks for all your videos Brad =).
@DivineJesusPrayers
@DivineJesusPrayers 6 жыл бұрын
Brad, you are truly a blessing to the learning community in this channel of yours. Your passion to teach and see your students succeed is unprecedented. You give above and beyond what one would normally term as 'free content'. I love this content, the name is just awesome, the tutorial is pure gold! Please release more of such series in future as time permits you. From the deepest recess of my heart, I am most grateful sir.
@_DeProgrammer
@_DeProgrammer 6 жыл бұрын
agreed, Brad is the man.
@chees720
@chees720 6 жыл бұрын
thanks Brad
JavaScript Cardio [Session 2] - LongestWord, Anagrams, Array Chunking
42:27
JavaScript Higher Order Functions & Arrays
34:56
Traversy Media
Рет қаралды 989 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
The Importance of Specialization in Coding
7:13
Traversy Media
Рет қаралды 241 М.
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
Async JS Crash Course - Callbacks, Promises, Async Await
24:31
Traversy Media
Рет қаралды 1,4 МЛН
JSON Crash Course
24:49
Traversy Media
Рет қаралды 1 МЛН
JavaScript OOP Crash Course (ES5 & ES6)
40:21
Traversy Media
Рет қаралды 593 М.
Object-oriented Programming in JavaScript: Made Super Simple | Mosh
1:02:49
Programming with Mosh
Рет қаралды 2 МЛН
Data Structures and Algorithms in JavaScript - Full Course for Beginners
1:52:55
Build A Speed Typing Game In JavaScript
32:37
Traversy Media
Рет қаралды 102 М.
JavaScript Cardio [Session 3] - Add All, Sum Primes, Seek & Destroy
40:24
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН