Deprecated: Creation of dynamic property Google\Site_Kit\Core\Authentication\Setup::$proxy_support_link_url is deprecated in /home/jtseng7273/public_html/myehouse.com/wp-content/plugins/google-site-kit/includes/Core/Authentication/Setup.php on line 94

Deprecated: Creation of dynamic property Google\Site_Kit\Modules\AdSense\Web_Tag::$module_slug is deprecated in /home/jtseng7273/public_html/myehouse.com/wp-content/plugins/google-site-kit/includes/Core/Modules/Tags/Module_Tag.php on line 42

Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Analytics\Web_Tag::$module_slug is deprecated in /home/jtseng7273/public_html/myehouse.com/wp-content/plugins/google-site-kit/includes/Core/Modules/Tags/Module_Tag.php on line 42

Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Analytics_4\Web_Tag::$module_slug is deprecated in /home/jtseng7273/public_html/myehouse.com/wp-content/plugins/google-site-kit/includes/Core/Modules/Tags/Module_Tag.php on line 42
Print a 10x10 multiplication table - Coder Blogger

Print a 10×10 multiplication table

JavaScript | Easy
Task:
Create a 10x10 multiplication table that goes from 0 to 10. The table needs to be neatly formatted/aligned.

Bonus:
highlight the header row and column.

My Solution

Please take a moment and try to solve the challenge. If you are stuck, or when you are done, come back any time and see how I did it.


<div id="mtable"></div>
table {
	width: 100%;
}

table td {
	width: 9%;
	text-align: right;
	padding: 5px;
}

table td.header {
	background-color: #ccc;
}
let mtable = document.querySelector("#mtable");
let outstring = "<table>";

for (x=0; x<=10; x++) {
	outstring += "<tr>";
	for (y=0; y<=10; y++) {
	
	if (x*y===0) {
		outstring += "<td class='header'>";
	} else {
		outstring += "<td>";
	}
	
	outstring += x*y + "</td>";
	}
	outstring += "</tr>"
}

outstring += "</table>";

mtable.innerHTML = outstring;
Output of Multiplication Table