JSFiddle - React, Tailwind, and code Playground

JavaScript

function hitler(N) {
	var res = "";
	for (var i = 0; i < N; i++) {
		for (var j = 0; j < N * 2 + 2; j++) {
			if (j < (N - i) * 2)
				res += "  ";
			else if (j > N * 2 - i * 2 + i)
				res += (N * 2 + 2 - j) % 10;
			else
				res += (j - (N - i) * 2 + 1) % 10;
		}
		res += "\n";
	}
	return res;
}

alert(hitler(12));