32 Remove Whitespace from Start and End - Regular Expressions - freeCodeCamp

preview_player
Показать описание
Hi,

I'm Mike Mind and I'll help you solve the freeCodeCamp exercises to learn code, get a certification and become a professional web developer.

In this coding tutorial series, we'll focus on Regular Expressions.

Any feedback is appreciated, I'll answer all your questions/suggestions!

Thank you!

#freeCodeCamp
#coding
#regex
#freeCodeCamp
#coding
#regex
#HTML
#CSS
#JS
#JavaScript
#WebDevelopment
#WebDev
#Programming
#Beginner
#LearnToCode
#MikeMind
#MikeMindAcodemy
Рекомендации по теме
Комментарии
Автор

Nice Explanation. In this specific exercise, I could also use this as a solution:
let hello = " Hello, World! ";

let wsRegex = /(\s{2, })/g; // Change this line
let result = hello.replace(wsRegex, ''); // Change this line
However, this will only work if there are at least 2 white spaces at the start and end of a string.

ganeshharikrishnan
Автор

Thanks for providing an alternate solution compared to the Get Hint section in FCC!

rhinethetauren