Please enable JavaScript to use CodeHS

Exercise : The Identity Function

1 point

The Identity Function


(function() { var testResults = []; %StudentCode% // student code %SolutionCode% // solution code function assertEquals(test, studentOutput, solutionOutput, passMsg, failMsg, isHiddenTest) { // Deep compare the results with underscore. var success = _.isEqual(studentOutput, solutionOutput); var message = success ? passMsg : failMsg; testResults.push({ message:message, // Stringify to get pretty printed objects and arrays. solutionOutput: JSON.stringify(solutionOutput), studentOutput: JSON.stringify(studentOutput), success: success, test:test, isHiddenTest: isHiddenTest }); } %TestCases% return testResults; })();