Javascriot function 1

Javascriot function

// Five examples of non-arrow function expressions

function (x) { return x + x + x  }

function (s, n) { return s.length > n  }

function (p, n, r, t) { return p * Math.pow(1 + (r / n), n * t)  }

function () { return Math.random() * 100  }

function (x, y) {
  let xSquared = x * x
  let ySquared = y * y
  return Math.sqrt(xSquared + ySquared)
}

Here is what the above code is Doing:
1. The first line is a function declaration.
2. The second line is a function expression.
3. The third line is a function expression.
4. The fourth line is a function expression.
5. The fifth line is a function expression.

Similar Posts