News

Pure Function Example: A pure function that takes two numbers and returns their sum. function add(a, b) { return a + b; } console.log(add(2, 3)); // Output: 5 This function is pure because it ...
This is pure, in that there’s nothing changed outside the function and there’s no observable behavior of the function other than returning the result. This is just like the mathematical function. s(n) ...