CodeLab
Tutorials For Everyone
Run
<!DOCTYPE html> <html> <head> <title>JavaScript console.table() Function Tutorial - TutsInsider</title> <style> .main{ padding: 10px; } .main-heading{ background: #333333; color: #ffffff; padding: 20px; } .main-paragraph{ margin-top: -20px; padding: 20px; box-shadow: inset 0 0 3px 0 #2a73cc; } .main-button{ padding: 5px 10px; margin: 5px; border: none; border-radius: 5px; background: #333333; color: #ffffff; box-shadow: 0 0 3px 0 #333333; cursor: pointer; } </style> </head> <body> <div class="main"> <h2 class="main-heading">What is JavaScript console.table() Function?</h2> <div class="main-paragraph"> <p>Press <strong>F12</strong> on your keyboard to open the Browser's console.</p> <p>Inside 'Console', you will see the output of the Script below.</p> <p>The below example uses the JS <strong>console.table()</strong> function to display information about three scientists, their date of birth, their country, and their contribution to science. <strong>Open the console to display the ouput.</strong></p> </div> </div> <script> let scientists = [ { name: "Albert Einstein", dob: "1879-03-14", country: "Germany", contribution: "Theory of General Relativity" }, { name: "Isaac Newton", dob: "1643-01-04", country: "England", contribution: "Laws of Motion, Universal Gravitation" }, { name: "Galileo Galilei", dob: "1564-02-15", country: "Italy", contribution: "Law of Inertia, Heliocentrism" } ]; console.table(scientists); </script> </body> </html>