-1

I am using the babel env preset which allows me to use es2017. I have tested the padStart function on this example: 'a'.padStart(2, '0') which yields 0a. Which is correct and means it's working.

However, when I use it on an object it does not work. exp_month.padStart(2, '0') yields exp_month.padStart is not a function

Rob
  • 6,758
  • 4
  • 46
  • 51

1 Answers1

-1

Ok, so just worked out that the object property was of type Integer. So what I did to resolve the issue was exp_month.toString().padStart(2, '0').

Rob
  • 6,758
  • 4
  • 46
  • 51