Skip to content

Commit 4115675

Browse files
committed
Added Must Know DevTools Tricks (wesbos#9)
1 parent 9ec17bf commit 4115675

1 file changed

Lines changed: 40 additions & 8 deletions

File tree

09 - Dev Tools Domination/index-START.html

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</head>
77
<body>
88

9-
<p onClick="makeGreen()">×BREAK×DOWN×</p>
9+
<p onclick="makeGreen()">×BREAK×DOWN×</p>
1010

1111
<script>
1212
const dogs = [{ name: 'Snickers', age: 2 }, { name: 'hugo', age: 8 }];
@@ -18,29 +18,61 @@
1818
}
1919

2020
// Regular
21+
console.log('hello');
2122

2223
// Interpolated
24+
const myVar = 'variable';
25+
console.log('Hello I am a %s string', 'interpolated');
26+
console.log(`Hello I am a ${myVar} string`);
2327

2428
// Styled
29+
console.log('%c I am some big text', 'font-size: 2em');
2530

26-
// warning!
31+
// Warning!
32+
console.warn('WARNING !!!')
2733

2834
// Error :|
35+
console.error('Fatal error :/ ')
2936

3037
// Info
38+
console.info('World Tapir Day is celebrated on 27 April each year. \nhttp://www.tapirday.org/')
3139

3240
// Testing
41+
const p = document.querySelector('p');
42+
console.assert(p.classList.contains('ouch'), 'This is not the right element.')
3343

34-
// clearing
44+
// Clearing
45+
console.clear();
3546

3647
// Viewing DOM Elements
48+
console.dir(p);
3749

3850
// Grouping together
39-
40-
// counting
41-
42-
// timing
43-
51+
dogs.forEach(d => {
52+
console.groupCollapsed(`${d.name}`);
53+
console.log(`This is ${d.name}`);
54+
console.log(`${d.name} is ${d.age} years old.`);
55+
console.log(`That makes ${d.age * 7} dog years old!`);
56+
console.groupEnd(`${d.name}`);
57+
});
58+
59+
// Counting
60+
console.count('lol');
61+
console.count('lol');
62+
console.count('lol');
63+
console.count('lol');
64+
65+
// Timing
66+
console.time('fetching data');
67+
fetch('https://api.github.com/users/jeffdess')
68+
.then(data => data.json())
69+
.then(data => {
70+
console.timeEnd('fetching data');
71+
console.log(data);
72+
});
73+
74+
// Data table
75+
console.table(dogs);
4476
</script>
4577
</body>
4678
</html>

0 commit comments

Comments
 (0)