Answers for "check if character is space javascript"

3

javascript detect space in string

if(str.indexOf(' ') >= 0){
    console.log("contains spaces");
}
Posted by: Guest on November-14-2020
0

javascript check if string ends with space

const str = "hello world ";
    const a = str.slice(-1);
    if (a == " ") {
        console.log("ends with space");

    }
Posted by: Guest on June-11-2021

Code answers related to "check if character is space javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language