Codecademy Forums

Javascript Higher Order Functions as Parameters Autochecker

const checkConsistentOutput = (var1, fn) => {
  var res1 = fn(var1);
  var res2 = fn(var1);
  if (res1 == res2) {
    return fn(var1)
  else {
    return 'This function returned inconsistent results'

Maybe someone could explain why code was considered wrong by the autochecker…

Could it be the return value is incorrect? What if you just return res1?