JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = 'hello!';
var result = str.endsWith('lo!');

// prints "true"
console.log(result);

// verify as if the string was "hell"
result = str.endsWith('lo!', 5);

// prints "false"
console.log(result);