functions


Node.js

  1. function add(a, b) {
  2. return a + b
  3. }
  4. const result = add(2,3)
  5. console.log(result)

Output

  1. 5

Go

  1. package main
  2. import "fmt"
  3. func add(a int, b int) int {
  4. return a + b
  5. }
  6. func main() {
  7. result := add(2, 3)
  8. fmt.Println(result)
  9. }

Output

  1. 5