Javascript console.table() Method display array

Introduction

Using an array of objects:

Press F12 on your keyboard to view the table in the console view.

View in separate window

<!DOCTYPE html>
<html>
<body>
<script>

var car1 = { name : "HTML", model : "mark" }
var car2 = { name : "Javascript", model : "logic" }
var car3 = { name : "CSS", model : "Fusion" }

console.table([car1, car2, car3]);
</script>//from www .j  a va  2 s  . c  om

<p>This example demonstrates the console.table() method, with an array of objects as the first parameter.</p>

</body>
</html>



PreviousNext

Related