This question already has an answer here:
- Reference - What does this regex mean? 1 answer
- Check if a string has white space 4 answers
Both results: res1 and res2 give value: true, irrespective of space is added in the string or not.
var res1 = /[^\s]/.test("demotest");
var res2 = /[^\s]/.test("demo test");
The expected result should be: false for res2 and true for res1.
Aucun commentaire:
Enregistrer un commentaire