-1

I would like to have the result :

28,12,2016 From this string "28/12/2016"

I tried :

("28/12/2016").replace('/',',');

 ==>"28,12/2016"

I don't know how to delete the second /and the " "

Orsay
  • 1,080
  • 2
  • 12
  • 32

1 Answers1

1

use split and join method

var a="28/12/2016";
var ans=a.split("/").join(",");
console.log(ans);
Mahi
  • 1,707
  • 11
  • 22