Match Non-Whitespaces

Tell us what’s happening:

Am I supposed to match non-whitespaces with /\S/g or with /[\S]/g
Thanks for help

Your code so far


let sample = "Whitespace is important in separating words";
let countNonWhiteSpace = /[\S]/g; // Change this line
let result = sample.match(countNonWhiteSpace);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.62 Safari/537.36

Challenge: Match Non-Whitespace Characters

Link to the challenge:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.