'Is there a way for me to send args[1] args[2] times?

I want my bot to be able to send someone a DM of args[1] however many times args[2] is. I think it should be pretty simple but so far I haven't found a way to do it. This is my code so far:

module.exports = {
    name: 'message',
    description: 'message',
    execute(message, args) {    
         
        let recipient = message.mentions.users.first()
        
        if (message.author.id === 'My ID') {
            recipient.send(args[1])
        }       
            if ((!args[1])) return message.channel.send('Please include the message you want to send.')            
            if (isNaN(args[2])) return message.channel.send('Please include how many times you want the message to send.')
    }          
}


Solution 1:[1]

You can use a simple for loop:

module.exports = {
  name: 'message',
  description: 'message',
  execute(message, args) {
    let recipient = message.mentions.users.first();

    if (!args[1])
      return message.channel.send(
        'Please include the message you want to send.',
      );
    if (isNaN(args[2]))
      return message.channel.send(
        'Please include how many times you want to send the message.',
      );

    if (message.author.id === 'My ID') {
      for (let i = 0; i < args[2]; i++) {
        recipient.send(args[1]);
      }
    }
  },
};

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1