-1

I tried to do that like as:

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

It return me string current year

POV
  • 11,293
  • 34
  • 107
  • 201

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,254
  • 1
  • 9
  • 21