Mid JavaScript

What are pure functions?

Functions that:

  • Return the same output for the same input.
  • Have no side effects.

Example:

function add(a, b) {

return a + b; // pure

More from JavaScript Tutorial

All questions for this course