Object.entries(obj).map(([ key, value ]) =>
{
xml += `<ns1:${key}>${value instanceof Object ? parseXML(value) : value }</ns1:${key}>`
}
);
<ns1:InsuranceCompany>RESO_GARANTIJA</ns1:InsuranceCompany><ns1:UsageStart>2019</ns1:UsageStart><ns1:VehicleYear>2019</ns1:VehicleYear><ns1:Mark>audi</ns1:Mark><ns1:Model>a6</ns1:Model><ns1:Modification>,,,</ns1:Modification>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<h1>hello</h1>
<script type="text/javascript" src="./index.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="./index.js"></script>
</head>
<body>
<h1></h1>
</body>
</html>
Уберите + 1 и посмотрите другие месяцы.