I have next code in javascript:
csvReport.name = "My New Report";
$scope.filename = csvReport.name.replace(" ", "_");
But I get $scope.filename = My_New Report
. Not all spaces replacing.
What is it?
.replace
will always replace the first occurence except if you use regular expression like that :
csvReport.name.replace(/ /g, "_");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With