code.ashish.me

Atom feed

Recently added: 02 Count Of Subset Sum, 416 Partition Equal Subset Sum, 01 Subset Sum, 518 Coin Change 2, 983 Minimum Cost For Tickets

05 Confirm Ending

/**
 * Created by Ashish Patel
 * Copyright © 2017 ashish.me
 * ashishsushilpatel@gmail.com 
 */

/**
 * Program:
 * Check if a string (first argument, str) ends with the given target string (second argument, target).
 */

 function confirmEnding(str, term) {
    return str.substring(str.length - term.length, str.length) === term;
 }

 console.log(confirmEnding("Beautiful", "l"));

Created 2019-11-24T04:41:20+05:18 · Edit