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
JavaScript sort multi dimensional array on specific columns
How to change the height of Textarea on click?
Edit the text of label on click using jQuery
ES6 method of declaration multiple variables in one line
jQuery simple form with name and email validations
JavaScript convert string variable in boolean using Regex