Challenge: Purify the Function

This challenge will test your skills in implementing pure functions in JavaScript.

We'll cover the following

Problem statement #

The following code has an impure function addAndPrint. Figure out why it’s impure and modify it into a pure function.

Input #

Impure Function

Output #

Pure Function

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.