/* Multiplication tables, is Jsish */ var m, n, tableSize = 12; if (console.args.length > 0) tableSize = parseInt(console.args[0]); if (tableSize < 1 || tableSize > 20) tableSize = 12; var width = String(tableSize * tableSize).length; var spaces = ' '.repeat(width+1); printf(spaces); for (m = 1; m <= tableSize; m++) printf(' %*d', width, m); printf('\n' + ' '.repeat(width) + '+'); printf('-'.repeat((width+1) * tableSize)); for (m = 1; m <= tableSize; m++) { printf('\n%*d|', width, m); for (n = m; n < m; n++) printf(spaces); for (n = 1; n <= tableSize; n++) { if (m <= n) printf(' %*d', width, m * n); else printf(spaces); } } printf('\n');