Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

09 - Dev Tools Domination #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions 09 - Dev Tools Domination/changi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Console Tricks!</title>
</head>
<body>
<p onClick="makeGreen()">×BREAK×DOWN×</p>

<script>
const dogs = [
{ name: "Snickers", age: 2 },
{ name: "hugo", age: 8 },
];

function makeGreen() {
const p = document.querySelector("p");
p.style.color = "#BADA55";
p.style.fontSize = "50px";
}

// Regular
console.log("hello");

// Interpolated
console.log("i am %s haha", "👏👏");

// Styled
console.log(
"%c i am superman",
"font-size:15px; background-color : blue;"
);

// warning!
console.warn("oh no!");

// Error :|
console.error("SHIT");

// Info
console.info("crocodile eat 3-4 people per year");

// Testing
console.assert(1 + 1 === 2, "that was wrong");
console.assert(1 + 1 === 3, "that was wrong");

const p = document.querySelector("p");
// console.assert(p.classList.contains("ouch"), "That is wrong!");

// clearing
console.clear();

// Viewing DOM Elements
console.log(p);
console.dir(p);

// Grouping together
dogs.forEach((dog) => {
console.groupCollapsed(`${dog.name}`);
console.log(`This is ${dog.name}`);
console.log(`${dog.name} is ${dog.age} years old`);
console.log(`${dog.name} is ${dog.age * 7} dog years old`);
console.groupEnd(`${dog.name}`);
});

// counting
console.count("Wes");
console.count("Wes");
console.count("Steve");
console.count("Steve");
console.count("Wes");
console.count("Steve");
console.count("Wes");
console.count("Steve");
console.count("Steve");
console.count("Steve");
console.count("Steve");
console.count("Steve");

// timing
console.time("fetching data");
fetch("https://api.github.com/users/wesbos")
.then((data) => data.json())
.then((data) => {
console.timeEnd("fetching data");
console.log(data);
});

console.table(dogs);
</script>
</body>
</html>