function repeat(str, count) {
return count < 0 ? '' : (new Array(count)).join(str);
}
function diamond(sign, size) {
var d,
s = ''
for (var i = 0; i < size*2; i++) {
d = Math.abs(size-i-1);
console.log(d+1, 2*(size-d));
s += repeat(' ', d+1) + repeat(sign, 2*(size-d)) + repeat(' ', d+1) + '<br/>';
};
document.write(s);
}
diamond('A', 5);