For Loop exercise

Hello everyone
i wanted to produce a unique message and append that message to the new created array but when i call the function its just create a message for the first Array name
here is my code :

const writeCards = (arr,event) => {
    const messages = []
    for(let i = 0; i < arr.length;i++) {
           const greetingMessage = `Thank you, ${arr[i]}, for the wonderful ${event} gift!`
           return messages

console.log(writeCards(["Charlie", "Samip", "Ali"], "birthday"))

any Hint will be appreciated.

Your return statement is in the wrong place. Once you call return, you will exit the function entirely, so you should only call it when you have everything you need from the function.

Thanks alot @bvanb, it worked, as you said the return statement was in the wrong place

  'Thank you, Charlie, for the wonderful birthday gift!',
  'Thank you, Samip, for the wonderful birthday gift!',
  'Thank you, Ali, for the wonderful birthday gift!'