title: How do I terminate a loop in node.js?
body: <p>I'm making a discord bot, and I created a command where whenever someone executes the command &quot;!ping @ example&quot;, then it would ping @example once every minute until @example stops it. I have created the loop successfully, however, I can't terminate the loop.</p>
  <pre><code>var interval = setInterval (function () {
    const user = message.mentions.users.first();
              message.channel.send('You have been pinged!' + '\n' + '&lt;@' + user + '&gt;')
  
          }, 1 * 60000);
  </code></pre>