Declarative Approach
<script>
alert(confirmEnd("Go was designed with parallel and concurrent processing in mind", "mind")); // true
alert(confirmEnd("Go was designed with parallel and concurrent processing in mind", "brain")); // false
alert(confirmEnd("Go was designed with parallel and concurrent processing in mind", "d")); // true
alert(confirmEnd("Go was designed with parallel and concurrent processing in mind", "D")); // false
function confirmEnd(str, target) {
return str.slice(str.length - target.length) === target;
}
</script>
Most Helpful This Week
Highlight and get the details of table row on click using JavaScript
jQuery show input text inside div after on click event
Edit the text of label on click using jQuery
How can I redirect the user from one page to another using jQuery or pure JavaScript?
ES6 method of declaration multiple variables in one line
How to join string with number in JavaScript?