Must commonly used. Print the results to debug.
let someObject = { str: "Some text", id: 5 };
console.log(someObject);
// output: {str: "Some text", id: 5}
console.log(3 + 5);
// output: 8
Calculate the duration of a specific operation.
console.time("answer time");
alert("Click to continue");
// some function
console.timeEnd("answer time");
Displays tabular data as a table.
const Willy = { name: 'Willy', age: 20, handsome: false };
const Parker = { name: 'Parker', age: 23, handsome: true };
const Sam = { name: 'Sam', age: 25, handsome: false};
console.table([Willy, Parker, Sam]);
(index) | name | age | handsome |
0 | Willy | 20 | false |
1 | Parker | 23 | true |
2 | Sam | 25 | false |