• sugar_in_your_tea
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 days ago

    Modern JavaScript style recommends using arrow functions for anything that doesn’t need a context. Consider adjusting your code to the arrow function syntax:

    const addNumbers = (a, b) => a + b;
    

    Not only is this syntax shorter, it also gives you the benefits of a constant function. You can use it the same way you did in your existing code:

    console.log(addNumbers(3, 5));  // Outputs: 8
    

    For more JavaScript style suggestions, reply with more code.