javascript 打印菱形的型号
<script type="text/javascript"> var prints = function() { this.initPrint.apply(this, arguments); }; prints.prototype = { initPrint: function () { var len = 4; for (var i = 0; i < len; i++) { for (var n = 0; n < len - i; n++) { window.document.write(" "); } for (var j = 0; j < i; j++) { window.document.write("*"); } window.document.writeln("<br/>"); } for (var k = 0; k < len; k++) { for (var m = 0; m < k; m++) { window.document.write(" "); } for (var l = 0; l < len - k; l++) { window.document.write("*"); } window.document.writeln("<br/>"); } } }; prints.prototype.initPrint(); </script>
将来的你,一定会感谢现在努力的自己!