1//What you can do is hook the console.log function so that you store when it logs :
2console.stdlog = console.log.bind(console);
3console.logs = [];
4console.log = function(){
5 console.logs.push(Array.from(arguments));
6 console.stdlog.apply(console, arguments);
7}
1var str = "Howdy GeeksforGeeks"
2var geek = {
3 book: "harrypotter",
4 price: "2000"
5};
6var geek2 = [10, 20, 30];
7console.log(str);
8console.dir(str);
9console.dir(geek);
10console.log("geek (log) = ", geek);
11console.dir(geek2);
12console.log("geek2 (log) = ", geek2);
13
14// Prints only string as dir() takes
15// only one parameter.
16console.dir("geek2 (dir) = ", geek2);
1console.log('log-message'); // Outputs a normal information log to the console window
2console.warn('warn-message'); // Outputs warning in the console window
3console.error('error-message'); // Outputs error in the console window
4console.table('table-message'); // Outputs a table of all the object properties
1/*
2
3shortcuts:
4
5command K = clears the console
6command shift M = toggle device toolbar
7command shift C = select something on the page
8
9you can also log in a variable you may have coded:
10
11x;
12[value of x at that moment]
13
14if you're animating something:
15noLoop();
16[stops the animation]
17
18loop();
19[continues the animation]
20
21you can also code somewhat intricate text:
22
23for (var i = 0; i > 10; i++) {
24 console.log([variable or anything]);
25}
26
27some functions are also available to use:
28
29function mousePressed() {
30 console.log([anything]);
31}
32
33function keyPressed() {
34 noLoop(); [or anything else]
35}
36
37*/