String.prototype.isWhitespace() - mkloubert/jsToolbox GitHub Wiki

String.prototype.isWhitespace() method

Checks if the string is empty or contains whitespaces only.

Syntax

String.prototype.isWhitespace();

Result

String is empty / contains whitespaces only or not.

Examples

// (true)
var res1 = '     '.isWhitespace();
// (true)
var res2 = ''.isWhitespace();
// (false)
var res3 = ' TM '.isWhitespace();