• Sergio@slrpnk.net
      link
      fedilink
      English
      arrow-up
      12
      ·
      4 months ago

      > be me > look at source of comment above > be excited bc I finally see how to make greentext-style comments that begin with “>” > but the comment linewraps so it doesn’t work FML

      > spend half an hour copy-pasting and looking at things character-by-character
      > finally figure out that you have to end lines with two spaces
      > why? who cares, it works.
      > mfw: hackerman.jpg

    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      4 months 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.