I Have an array name friends. I want to print all the (not single) name which are tiny from this array. How i can solve it??:
function tinyFriend(friends) {
let tinyFriend = friends[0]
for (let i = 0; i < friends.length; i++) {
let element = friends[i]
if (tinyFriend.length>element.length) {
tinyFriend = element
}
}
console.log("The Smallest Name is",tinyFriend)
}
let friends = ["kamal","shak","shak","shakib", "brac"]
tinyFriend(friends)
my expected result is shak,shak,brac