How to get element with specific length (ex: length = 7) in array If there's no element with length = 7, I want to print something. If I do inside the loop it will print many times base on number of element.
let txt = `abc klj 1123 MPM SN67990 MKP LJJ`
let arr = txt.split(' ')
console.log(arr)
for (let i = 0; i < arr.length; i++) {
if (arr[i].length == 7) {
console.log(arr[i])
}
// TODO: if no element with length = 7 in arr
}