I have searched and found ways to check for ALL whitespace existence between letters in a string but what about if the string contains a space, tab or enter at the end?
For example:
let str="John ";
console.log(str.includes(' '));
The above console.log
will return true because there is a space at the end, however that is not relevant for me. I only wanted to check for:
let str="J o h n";
How to achieve this with Javascript ( and ignore space check at the end)?