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
How to get selected text from a select box using jQuery?
jQuery get the coordinates of div clicked
How to scroll page to 1000px from top on page load using jQuery?
How to define Global Variable in JavaScript?
Image Rollover Using onMouseOver and onMouseOut
JavaScript example to change image on click