C# string format variable name code example
Example: format string of names
function list(names) {
var xs = names.map((p) => p.name);
var x = xs.pop();
return xs.length ? xs.join(", ") + " & " + x : x || "";
}
// Example:
// list([ {name: 'Bart'}, {name: 'Lisa'}, {name: 'Maggie'} ])
// returns 'Bart, Lisa & Maggie'