Junior JavaScript

What is a pure function?

A function that:

  • Always returns the same output for the same input
  • Has no side effects (doesn’t modify external variables)

Example:

function sum(a, b) {

return a + b;

More from JavaScript Tutorial

All questions for this course