Check if a String is a palindrome with JavaScript Tutorial

  Рет қаралды 20,972

Code With Bubb

Code With Bubb

Күн бұрын

Пікірлер: 29
@codewithbubb
@codewithbubb 5 жыл бұрын
Also check out how to find the largest number in an array: kzbin.info/www/bejne/nICphKB5n9uWfLs
@georgemichael9481
@georgemichael9481 3 жыл бұрын
I guess it's kind of off topic but does anybody know a good site to watch new movies online ?
@titanachilles7627
@titanachilles7627 3 жыл бұрын
@George Michael Lately I have been using FlixZone. Just search on google for it =)
@markcory215
@markcory215 3 жыл бұрын
@Titan Achilles Definitely, I have been using Flixzone for years myself =)
@georgemichael9481
@georgemichael9481 3 жыл бұрын
@Titan Achilles Thank you, I signed up and it seems like a nice service :D I appreciate it!
@titanachilles7627
@titanachilles7627 3 жыл бұрын
@George Michael no problem xD
@nageshthotakura8758
@nageshthotakura8758 3 жыл бұрын
You are amazing. Thank you for your efforts.
@codewithbubb
@codewithbubb 3 жыл бұрын
Thanks very much, appreciate your support!
@marykhachatryan2049
@marykhachatryan2049 4 жыл бұрын
This was actually very useful! Thank you :)
@codewithbubb
@codewithbubb 4 жыл бұрын
Thanks Mary! Glad you found it useful😀
@ТаисияБартенева-щ1з
@ТаисияБартенева-щ1з 4 жыл бұрын
Thank you for this video!
@codewithbubb
@codewithbubb 4 жыл бұрын
You're welcome - hope you found it useful!
@Corumt
@Corumt 4 жыл бұрын
Can you do something on how to get odd and even numbers using arrays
@codewithbubb
@codewithbubb 4 жыл бұрын
Sure, i'll put something together.
@Girlgirls12233
@Girlgirls12233 3 жыл бұрын
i don't understand why - i? and not just[ inStr.length - 1 ]
@kremowydzien
@kremowydzien 5 жыл бұрын
I didn't think by myself about turn to lower case and removing the non-alphanumerical characters. I did it after watching the video. I used this solution: const isPalyndrome = (str) => { str = str.replace(/[^a-z]/gi, "").toLowerCase(); const reverse = str.split("").reverse().join("").toLowerCase(); return str === reverse; }
@codewithbubb
@codewithbubb 5 жыл бұрын
Yep, good practice to lower case everything to make sure it matches. I like the Regex to remove the non-alpha characters (could also use \W to match non-alphanumeric too 😉).
@EduardoOviedoBlanco
@EduardoOviedoBlanco 3 жыл бұрын
I think your first solution was better than the second one
@blurrywaters
@blurrywaters Жыл бұрын
Could someone explain the inStr[inStr.length - 1 - i] I’m confused on this.
@Stancehall
@Stancehall Жыл бұрын
You still need help?
@blurrywaters
@blurrywaters Жыл бұрын
@@Stancehall if you could explain the statement above yes that’s be very helpful, thanks!
@selchukkarakus6169
@selchukkarakus6169 5 жыл бұрын
This code doesn't work with strings containing - (hyphen)or _ (underscore) eg "_eye" or "0_0 (: /-\ :) 0-0" ?
@codewithbubb
@codewithbubb 5 жыл бұрын
Yeah, the \W word boundary won't pick these up and remove them (I would consider hypens to be part of words but not sure about underscores?). You can adjust your regex to suit your requirements / rules of what should be considered part of the palindrome. e.g /[^a-z]/gi will remove anything that's not actually a letter. Hope that helps?
@uaplatformacomua
@uaplatformacomua 5 жыл бұрын
So hard I got the issue
@velmurugan.personel
@velmurugan.personel 5 жыл бұрын
Why not use this i++ instead of i+=1 and inStr[inStr.length - 1] instead of this inStr[inStr.length - 1 -i ]
@codewithbubb
@codewithbubb 5 жыл бұрын
Yes, i++ is fine however it's discouraged in a lot of JavaScript style guides (like AirBnB) so ES Lint complains about it. I've just got in to the habit of using that format now!
@velmurugan.personel
@velmurugan.personel 5 жыл бұрын
@@codewithbubb Thanks your response man keep rocking.......
@codewithbubb
@codewithbubb 5 жыл бұрын
You're welcome! Thanks for your comment also, it's good to question things all the time!
Reduce: 10 Different Examples. JavaScript Fundamentals.
26:57
Leigh Halliday
Рет қаралды 29 М.
How to reverse a String in JavaScript Tutorial
5:06
Code With Bubb
Рет қаралды 32 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
3 Coding Secrets I Wish I Knew Earlier
9:38
Code With Bubb
Рет қаралды 1,2 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 1,1 МЛН
What is mathematical thinking actually like?
9:44
Benjamin Keep, PhD, JD
Рет қаралды 24 М.
JavaScript Practice Exercises For Beginners: Beginner Exercises Part 1
14:07
Learn DOM Manipulation In 18 Minutes
18:37
Web Dev Simplified
Рет қаралды 1 МЛН
Learn JavaScript - Full Course for Beginners
3:26:43
freeCodeCamp.org
Рет қаралды 19 МЛН
JS Interview - Palindromes - Question 17
5:49
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 16 М.
How To Solve Algorithms - Adding Linked Lists
13:50
Web Dev Simplified
Рет қаралды 15 М.
Codewars JavaScript Tutorial: How to approach solving basic kata
14:24
Saving User Input in JS Objects
8:00
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 202 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН