SOURCE

str1 = "hello haizei";
str2 = "hello"

function endsWith(str, str_1) {
    tmp = str.slice((str.length - str_1.length), str.length);
    return (tmp == str_1);
}

ans = endsWith(str1, 'hello');
console.log(ans);
temp = endsWith(str2, 'hello');
console.log(temp);
console 命令行工具 X clear

                    
>
console