Check if a string has white space

PHOTO EMBED

Mon Jun 14 2021 12:34:46 GMT+0000 (Coordinated Universal Time)

Saved by @hisam #javascript

function hasWhiteSpace(s) {
  return s.indexOf(' ') >= 0;
}

//or

function hasWhiteSpace(s) {
  return /\s/g.test(s);
}
content_copyCOPY