Ad

You will be given an array of different entries.
Along with this, the second argument gives the desired length for cutting.
You must cut words of this length from the words in the array.
You will be given an array of different entries.
Along with this, the second argument gives the desired length for cutting.
You must cut words of this length from the words in the array.
***If the length of the word in the array is greater than the given length, fill in the blanks with words!!!

function getStrings(strings, length){
    let newArr = []
    for(let i = 0; i < strings.length; i++){
        if(strings[i].length >= length){
            newArr[i] = strings[i].slice(0, length)
        }else{
            newArr[i] = strings[i].slice(0, length) + "*".repeat(length - strings.length)
        }
    }
    return newArr
}

let result = getStrings(["Frontend", "Backend", "Flutter"], 15)

console.log(result)