-1

I tried to do that like as:

const int = Number(this.getCurrentYear());

It return me string current year

OPV
  • 1
  • 26
  • 81
  • 156

1 Answers1

0

You must parse it to an int

var numberAsString = "4566";
var numberAsInt = parseInt(numberAsString);

so change your code to this

const int = parseInt(this.getCurrentYear());

if this doesnt work either this.getCurrentYear() must not be a number(its either undefined or contains alphabets or symbols)

Ananthakrishnan Baji
  • 1,091
  • 1
  • 7
  • 19