Question #272481

Given a stringarray of string and startstring,endstring as input writen js program to fliter the string in stringArray start with startstring and end with endstring


Expert's answer

function main() {
    const stringsArray = JSON.parse(readLine().replace(/'/g'"'));
    const startString = readLine();
    const endString = readLine();
    /* Write your code here */

    const outputArray = stringsArray.filteritem => item.startsWith(startString) || item.endsWith(endString) );

    console.log(outputArray);
}
LATEST TUTORIALS
APPROVED BY CLIENTS