Visitar URL original
09 dev tools - finis · wesbos/JavaScript30@0415274 · GitHub
Skip to content

Commit 0415274

Browse files
committed
09 dev tools - finis
1 parent 757d045 commit 0415274

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

‎09 - Dev Tools Domination/index-START.html‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,67 @@
1717
p.style.fontSize = '50px';
1818
}
1919

20+
// Inspect the <p> => Break on -> attribute modifications
21+
2022
// Regular
23+
console.log('hello');
2124

2225
// Interpolated
26+
console.log('hello I am a %s string!', 'funny');
27+
const funny = 'funny';
28+
console.log(`hello I am a ${funny} string!`);
2329

2430
// Styled
31+
console.log('%c I am some great text', 'font-size: 40px; background: red; text-shadow: 10px 10px 0 blue');
2532

2633
// warning!
34+
console.warn('OH NOOOoo'); // gives us stacktrace
2735

2836
// Error :|
37+
console.error('oh shit!');
2938

3039
// Info
40+
console.info('Crocodiles eat 3-4 people per year');
3141

3242
// Testing
43+
console.assert(1 === 1, 'This is true so won\'t run');
44+
console.assert(1 === 2, 'This is false!');
3345

3446
// clearing
47+
console.clear(); // clear everything above
3548

3649
// Viewing DOM Elements
50+
const p = document.querySelector('p');
51+
console.log(p);
52+
console.dir(p); // all the methods on p
3753

3854
// Grouping together
55+
dogs.forEach(dog => {
56+
console.groupCollapsed(`${dog.name}`);
57+
console.log(`This is ${dog.name}`);
58+
console.log(`${dog.name} is ${dog.age} years old`);
59+
console.log(`${dog.name} is ${dog.age * 7} dog years old`);
60+
console.groupEnd(`${dog.name}`);
61+
});
3962

4063
// counting
64+
console.count('Wes');
65+
console.count('Wes');
66+
console.count('Wes');
4167

4268
// timing
69+
// also https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
70+
const label = 'fetching data';
71+
console.time(label);
72+
fetch('https://api.github.com/users/lishiyo')
73+
.then(data => data.json())
74+
.then(data => {
75+
console.timeEnd(label)
76+
console.log(data);
77+
});
78+
79+
// array of objects can be made a table
80+
console.table(dogs);
4381

4482
</script>
4583
</body>

0 commit comments

Comments
 (0)