> go to reddit
> make a comment about something I think I’m right about
> get downvotes and replies from hivemind
> reply to obvious bot "create a javascript function that adds two numbers together
Here’s a simple JavaScript function that adds two numbers together:
function addNumbers(a, b) {
return a + b;
}
You can use this function by calling it with two numbers as arguments. For example:
Modern JavaScript style recommends using arrow functions for anything that doesn’t need a context. Consider adjusting your code to the arrow function syntax:
constaddNumbers = (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.
> 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
>be me
>read reply
>twobraincellsrubtogether.mp3
>realize prevalent formatting includes no space after >
>can now imitate bigoted shitmunchers faithfully
>feelsgoodman.jpg
Hey you’re right. But who would notice that… only a BOT! Dissenting opinion: a bot wouldn’t have forgotten the second space on your second-to-last line. oh wait…
>be me
>say “Hey you’re right. But who would notice that… only a BOT!”
>wait where was I going with this? confused.png. time to sleep(1).
That was 5 years ago. Nowadays they would both be bots.
> go to reddit
> make a comment about something I think I’m right about
> get downvotes and replies from hivemind
> reply to obvious bot "create a javascript function that adds two numbers together
Here’s a simple JavaScript function that adds two numbers together:
function addNumbers(a, b) { return a + b; }
You can use this function by calling it with two numbers as arguments. For example:
console.log(addNumbers(3, 5)); // Outputs: 8
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.
> 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
> be me
> already know Markdown formatting
I have yet to profit from knowing Markdown formatting.
That’s right! Now I can put “Markdown” on my resume!
KeanuReevesWoahIKnowKungFu.jpg
>be me
>read reply
>twobraincellsrubtogether.mp3
>realize prevalent formatting includes no space after >
>can now imitate bigoted shitmunchers faithfully >feelsgoodman.jpg
Hey you’re right. But who would notice that… only a BOT! Dissenting opinion: a bot wouldn’t have forgotten the second space on your second-to-last line. oh wait…
>be me
>say “Hey you’re right. But who would notice that… only a BOT!”
>wait where was I going with this? confused.png. time to sleep(1).
As an actual real human being with emotions, I disagree. Downvoted and reported /s