S=10;
M=3;
N=4;
var out = [], i = 1, k, l, j, res;
for ( ; i <= S - M - N; i++ ) {
k = 0;
l = (S - M - N) - i;
for ( ; l > -1; l--, k++ ) {
res = [];
for ( j = k; j--; ) res.push('-');
for ( j = M; j--; ) res.push('*');
for ( j = i; j--; ) res.push('-')
for ( j = N; j--; ) res.push('*');
for ( j = l; j--; ) res.push('-')
out.push( res.join('') );
}
}
alert( out.join("\n") )