return values from functions

PHOTO EMBED

Wed Apr 12 2023 00:20:59 GMT+0000 (Coordinated Universal Time)

Saved by @davidmchale #function #return #values #filtering

function betweenYears(yearStart, yearEnd){
    return function(number){
          if(number >= yearStart && number <= yearEnd){
              return number
          }
          return false
    }
}

const myYear = betweenYears(1900, 1999);
myYear(1978);
content_copyCOPY