Spacing issues in FCCamp console vs no Spacing issues in Atom Text Editor

Two challenges I have done that I’ve had spacing issues with. The first one was in ES 6 when I had to create an array; my array was correct but I couldn’t add the extra blank beginning & ending line so I couldn’t pass the challenge. Then I did the same problem in Atom text editor and the empty array lines appeared without a problem

Today I was doing the last RegEx where you have to delete white space. In my Atom editor, it looks like the white space was deleted, but in FCC console the white space stayed the same. Wondering if this is just happening to me or to anyone else? Thanks! Also FWIW it’s worth I am using Safari mostly.

is it possible to post your code? Thanks.

OK it’s not Code Camps’ fault on the spacing. I’m just somehow not able to figure out how to replace the ending whitespace on the string. Here is my code:

let hello = "  Hello, World!  ";
let wsRegex = /^\s+hello\s+$/;
let result = hello.replace(/^\s/, '')

And so what I end up with is no white space at the beginning of Hello but still whitespace at the end. I’ve been trying to figure this out and can’t get it.

It looks like you understand how to find something at the start and end of a string. But what about the start or end of a string?

1 Like