vendredi 11 septembre 2020

nodejs return nothing when if statement true

so i have the following code

data.push(commands.map(
    command => {
        if (!command.devOnly) { return command.name; } // first condition
        if (command.devOnly && message.author.id != '3251268789058714880') {} // second condition
    },
).join('\n'));

if the second condition is true it returns null but then when I run console.log(data) it has a blank line for all the commands where the second condition is true.

Is there a way to stop the second condition from returning anything, and not leaving the blank line

Aucun commentaire:

Enregistrer un commentaire