Home > OS >  Assigning Multiple Values ​to a Variable in Node.js
Assigning Multiple Values ​to a Variable in Node.js

Time:05-02

const i = [1 || 2]
if (!message.channel.name.includes(o['opts'   i].identity.username.toLowerCase())) return message.channel.send('do commands only at <#bot-commands-id>');
console.log('oke');

How can I assign multiple values ​​to variable?

const i = [1 || 2 || 3 || 4 || 5]

as

CodePudding user response:

You just have to Use an array , and you do your condition with i[index] accessing all indexs with a for loop .

In your case is :

const i = [1 ,2 ];
for (let j = 0 , j <= i.length , j  ) {
   if (!message.channel.name.includes(o['opts'   i[j]].identity.username.toLowerCase())) return message.channel.send('do commands only at <#bot-commands-id>');
   console.log('oke');
}

  • Related