javascript check if string ends with space code example
Example: javascript check if string ends with space
const str = "hello world ";
const a = str.slice(-1);
if (a == " ") {
console.log("ends with space");
}
const str = "hello world ";
const a = str.slice(-1);
if (a == " ") {
console.log("ends with space");
}