Cómo verificar si la entrada de texto tiene espacios JavaScript

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