I don't see exactly what you want.. you want the double backslashes or not? if yes do this
function addWidget(el){
return "<!--#include virtual='backoffice\\\\home\\\widgets\\\\" + el + ".asp-->";
}
returns "<!--#include virtual='backoffice\\home\\widgets\\" + el + ".asp-->"
you need to escape each backslashe. so one for each = 2 more = \\\\
if you want to have only one backslash,
function addWidget(el){
return "<!--#include virtual='backoffice\\home\\widgets\\" + el + ".asp-->";
}
should work: it returns "<!--#include virtual='backoffice\home\widgets\" + el + ".asp-->";