I have this string:
var date = "3/2020";
I need the date in this format and adding a 0 if the month is less than 10:
var result = "2020-03";
I already did this:
var date = "3/2020";
var result = date.replace('/', '-');
console.log(result);
I just need a little help to know how could I add a 0 if the month is less than 10, and to change the order. Any Suggestion ?