Question: I want to convert dd/mm/yyyy to mm/dd/yyyy in javascript.

Answer: 
You can use the following function specified, 1 date and 2 the date separator (optional)
The date will be returned in the desired format.

```
const setFormatDDMMYYYYtoMMDDYYYY = (date, separator = '/') => {
  const [day, month, year] = date.split('/');
  return month + separator + day + separator + year;
};

```
```
  var currentDate = new Date()
  var day = currentDate.getDate()
  var month = currentDate.getMonth()
  var year = currentDate.getFullYear()
  document.write("<b>" + month + "/" + day + "/" + year + "</b>")

```