var resultado="", cifras = 3, maximo = Math.pow(10,cifras);
for (let i = 0; i < maximo; i++) {
let num = ("0".repeat(cifras-1) + i).slice(-cifras);
if (!~resultado.indexOf(num)) {
let digitos = 0;
for (let j = cifras-1; j; j--) {
if (resultado.endsWith(num.substring(0,j))) {
digitos = j;
break;
}
}
resultado += num.substring(digitos);
}
}
console.log(resultado);