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
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);
}
Comments
Leave a comment