13 Must Know Dev Tools Tricks
- 1. console.log()
- 2. Interpolation with %s
- console.log("Hello, I am a %s string!", "💩");
- // Hello, I am a 💩 string!
- 3. Styling with %c
- console.log("%c I am some great text",
- "font-size: 50px; background: red; text-shadow: 10px 10px 0 blue");
- 4. console.warn()
- // print custom warning message to console
- console.warn("OH NOES!);
- 5. console.error()
- // print custom error message to console
- console.error("Drats");
- 6. console.info()
- // print custom info message to console
- console.info('crocodiles eat 3-4 people per year"
- 7. console.assert()
- console.assert(1 === 2, "That is wrong!");
- // only returns if something is not true
- 8. console.clear()
- // clear up a messy console
- 9. console.dir()
- console.dir(p)
- // see all methods and properties for an element
- 10. console.group() with console.groupEnd()
- 11. console.count()
- // how many times is this method called?
- 12. console.time()
- // how long does something take?
- 13. console.table()
- //display an array of objects nicely in a table