Function getCentury

  • This function takes a year as a parameter and returns the century it belongs to.

    Parameters

    • year: number

      The year to determine the century for. Must be a valid year number.

    Returns number

    The century the year belongs to.

    Throws

    Will throw an error if the year is not a valid number.

    Example

    getCentury(2000);;
    //=> 20
    getCentury(1899);;
    //=> 19

Generated using TypeDoc