题解 | #直角三角形#
直角三角形
https://www.nowcoder.com/practice/7e8a7d83569d49aaa9bc4bb43a9d2d6e
{"html":"<!DOCTYPE html>\r\n<html lang=\"en\">\r\n <head>\r\n <meta charset=\"UTF-8\">\r\n </head>\r\n <body>\r\n <div class='triangle'></div>\r\n\r\n <script>\r\n var triangle = document.querySelector('.triangle');\r\n let str=''\r\n for(let i=1;i<4;i++){\r\n for(let j=0;j<i;j++)\r\n {\r\n str+= '*'\r\n }\r\n str += '<br/>'\r\n }\r\n\r\ntriangle.innerHTML=str\r\n \r\n \r\n </script>\r\n </body>\r\n</html>","css":"/* html, body {\\n\\twidth: 100%;\\n\\theight: 100%;\\n\\tmargin: 0;\\n\\tpadding: 0;\\n} */","js":"// 请在这里输入代码"}
innerHTML 会覆盖盒子里的全部内容