Answer to Question #272481 in HTML/JavaScript Web Application for Rishi

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


1
Expert's answer
2021-11-27T11:37:13-0500
function main() {
    const stringsArray = JSON.parse(readLine().replace(/'/g, '"'));
    const startString = readLine();
    const endString = readLine();
    /* Write your code here */

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

    console.log(outputArray);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS