Skip to content

Commit b90b11d

Browse files
committed
Completed Lesson wesbos#9
1 parent 692d3c7 commit b90b11d

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Console Tricks!</title>
6+
</head>
7+
<body>
8+
9+
<p onClick="makeGreen()">×BREAK×DOWN×</p>
10+
11+
<script>
12+
const dogs = [{ name: 'Snickers', age: 2 }, { name: 'hugo', age: 8 }];
13+
14+
function makeGreen() {
15+
const p = document.querySelector('p');
16+
p.style.color = '#BADA55';
17+
p.style.fontSize = '50px';
18+
}
19+
20+
// Regular
21+
console.log('hello');
22+
23+
// Interpolated
24+
console.log('Hello I am a %s string!', 'interpolated');
25+
26+
// Styled
27+
console.log('%c I am some great text', 'font-size:50px; background:red')
28+
29+
// warning!
30+
console.warn('ohhhh noooo');
31+
32+
// Error :|
33+
console.error('Shit!');
34+
35+
// Info
36+
console.info('info message.');
37+
38+
// Testing
39+
console.assert(1 === 2, 'you messed up!');
40+
41+
// clearing
42+
// console.clear();
43+
44+
// Viewing DOM Elements
45+
const p = document.querySelector('p');
46+
console.dir(p);
47+
48+
// Grouping together
49+
dogs.forEach(dog => {
50+
console.groupCollapsed(`${dog.name}`);
51+
console.log(`This is ${dog.name}`);
52+
console.log(`${dog.name} is ${dog.age} years old`);
53+
console.groupEnd(`${dog.name}`);
54+
});
55+
56+
// counting
57+
console.count('test');
58+
console.count('test');
59+
60+
// timing
61+
console.time('fetching data');
62+
fetch('https://api.github.com/users/mattmorganpdx')
63+
.then(data => data.json())
64+
.then(data => {
65+
console.timeEnd('fetching data');
66+
console.log(data);
67+
})
68+
69+
console.table(dogs);
70+
71+
</script>
72+
</body>
73+
</html>

0 commit comments

Comments
 (0)