What are all the difference between these two Javascript functions?

user3462433

1:

var sum = function (a, b){ return a+b; }

2:

var sum = function (a, b, callback ){ console.log(a+b); callback; }

I am trying to understand callback functions but I am not what is the key differences here ?

Quentin

One returns the result of adding (or concatenating) a and b.

The other logs that to the console instead of returning anything.

The callback variable isn't used. It is just mentioned, but that does nothing. It might as well not be there.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What is the difference between these two functions in Javascript?

From Dev

What's the difference between these two functions in JavaScript?

From Dev

What exactly is the difference between these two javascript functions?

From Dev

What is the difference between these two ways of changing a functions prototype in JavaScript?

From Dev

Javascript : What is the difference between these two fat arrow functions?

From Dev

What is the difference and issues between these two clojure functions?

From Java

What's the difference between these two functions

From Dev

What's the difference between these two functions?

From Dev

What is the difference between these two recursive functions?

From Dev

What is the difference between these two recursive ocaml functions?

From Dev

What is the difference between these two ruby functions?

From Dev

What is the difference between these two recursive functions?

From Dev

What is the difference and issues between these two clojure functions?

From Dev

What is the difference between these two ruby functions?

From Dev

What is the difference between scope of these two functions

From Dev

Javascript - What is the difference between these constructor functions?

From Dev

What is the difference between anonymous and inline functions in JavaScript?

From Dev

What is the difference between these JavaScript anonymous functions?

From Dev

Javascript - What is the difference between these constructor functions?

From Dev

What's the difference between these two statements in Javascript?

From Dev

What's the difference between these two statements in Javascript?

From Dev

What is the difference between these two snippets of javascript code?

From Dev

What is the difference between these two functions using async/await/TPL?

From Dev

What's the difference between these two ways to declare functions?

From Dev

What is the essential difference between the two functions to find the first negative entry?

From Dev

What is the essential difference between the two functions to find the first negative entry?

From Dev

What is the difference between these two C functions in terms of handling memory?

From Dev

What is the difference between accessors and normal functions in javascript object?

From Java

What is the difference between these arrow functions

Related Related

  1. 1

    What is the difference between these two functions in Javascript?

  2. 2

    What's the difference between these two functions in JavaScript?

  3. 3

    What exactly is the difference between these two javascript functions?

  4. 4

    What is the difference between these two ways of changing a functions prototype in JavaScript?

  5. 5

    Javascript : What is the difference between these two fat arrow functions?

  6. 6

    What is the difference and issues between these two clojure functions?

  7. 7

    What's the difference between these two functions

  8. 8

    What's the difference between these two functions?

  9. 9

    What is the difference between these two recursive functions?

  10. 10

    What is the difference between these two recursive ocaml functions?

  11. 11

    What is the difference between these two ruby functions?

  12. 12

    What is the difference between these two recursive functions?

  13. 13

    What is the difference and issues between these two clojure functions?

  14. 14

    What is the difference between these two ruby functions?

  15. 15

    What is the difference between scope of these two functions

  16. 16

    Javascript - What is the difference between these constructor functions?

  17. 17

    What is the difference between anonymous and inline functions in JavaScript?

  18. 18

    What is the difference between these JavaScript anonymous functions?

  19. 19

    Javascript - What is the difference between these constructor functions?

  20. 20

    What's the difference between these two statements in Javascript?

  21. 21

    What's the difference between these two statements in Javascript?

  22. 22

    What is the difference between these two snippets of javascript code?

  23. 23

    What is the difference between these two functions using async/await/TPL?

  24. 24

    What's the difference between these two ways to declare functions?

  25. 25

    What is the essential difference between the two functions to find the first negative entry?

  26. 26

    What is the essential difference between the two functions to find the first negative entry?

  27. 27

    What is the difference between these two C functions in terms of handling memory?

  28. 28

    What is the difference between accessors and normal functions in javascript object?

  29. 29

    What is the difference between these arrow functions

HotTag

Archive