Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. function confirmEnding(str, target) {
  2. //target must equal to the last letter of str
  3. if (str.substr(str.length-target.length,str.length)==target){
  4. console.log('true');
  5. }
  6. else{
  7. console.log('false');
  8. }
  9.  
  10. }
  11.  
  12. confirmEnding("He has to give me a new name", "name");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement