I'm trying to solve the following problem:
Complete the solution so that it returns true if the first argument (string) passed in ends with the 2nd argument (also a string).
Examples:
Solution ('abc', 'bc') // returns true, solution ('abc', 'd') // returns false Create a function that does this.
My code is:
function solution(str, ending){
return (str.split('').filter(str => str.length > str.length - 2).join('')) == ending ? "true" : "false"
}
The error I get:
expected 'false' to equal true