Use `console.log()` like a pro.

Using `console.log()` for JavaScript debugging is the most common practice. But, there is more…

🧵
* The most common Console methods:

console.log() – For general output of logging information.
console. info() – Informative logging.
console.debug() – A message to the console with the log level debug.
console.warn() – A warning message.
console.error() – An error message.
* Custom CSS styles for a console.log():

The `console.log` output can be styled in DevTools using the CSS format specifier.
* String substitutions:

When passing a string to one of the console object’s methods that accept a string (such as log()), you may use these substitution strings:

%s – string
%i or %d – integer
%o or %O – object
%f – float
* `console.assert()`:

Log a message and stack trace to the console if the first argument is false.
* `console.clear()`:

Clear the console.
* `console.count()`:

Log the number of times this line has been called with the given label.
* `console.dir()`:

Displays an interactive list of the properties of the specified JavaScript object.
* `console. group()` and `console.groupEnd()`:

Creates a new inline group, indenting all following output by another level. To move back out a level, call `groupEnd()`.
* HTML elements in the console:
* `console.memory`:

The memory property can be used to check out the heap size status
Note: memory is a property and not a method.
* `console.table()`:

Displays tabular data as a table.
* `console.time()` and `console.timeEnd()`:

console.time() – Starts a timer with a name specified as an input parameter. Up to 10,000 simultaneous timers can run on a given page.
console.timeEnd() – Stops the specified timer and logs the elapsed time in seconds since it started.
* `console.trace()`:

Outputs a stack trace.
If you like this thread, maybe you'd love to bookmark it as a post { via @hashnode }:
denic.hashnode.dev/use-consolelog…

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Marko ⚡ Denic

Marko ⚡ Denic Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @denicmarko

30 Oct
Host your apps for free.

🧵
1. Netlify

Link: netlify.com
2. Firebase

Link: firebase.google.com
Read 19 tweets
22 Sep
CSS tip:

Did you know that you can truncate the text with plain CSS? .truncate {   white-space: ...
You can see it in action here (via: @CodePen ):

codepen.io/denic/pen/LYpZ…
If you want to truncate the text to the specific number of lines, you can use "-webkit-line-clamp" property.
An ellipsis will be shown at the point where the text is clamped. .line-clamp {   display: -w...
Read 4 tweets
21 Sep
You want to learn HTML & CSS but don't know where to get started?

🧵
Choose a Code Editor:

💻 Visual Studio Code [VS Code]
💻 Sublime Text
💻 Atom
💻 Brackets
💻 Vim
Read 17 tweets
19 Sep
Freelancing platforms to find gigs:

🔨 Toptal
🔨 Codementor
🔨 Upwork
🔨 Freelancer
🔨 PeoplePerHour
🔨 Simply Hired
🔨 Codeable
🔨 Envato
🔨 Guru
🔨 Fiverr
🔨 AnyTask
🔨 Hireable
🔨 6nomads
🔨 Taskenator
🔨 TapChief

Which one do you use?
Read 4 tweets
18 Aug
Thank you! ♥️

"CSS Typing Effect" pen got more than 550 likes on @CodePen!

Check it out:
codepen.io/denic/pen/GRoO…
Other interesting pens:

"CSS-only modal":

codepen.io/denic/pen/ZEbK…
"CSS Smooth Scroll":

codepen.io/denic/pen/bGVe…
Read 8 tweets
11 Aug
Useful websites for web developers:

⧩ photopea. com
// Online photo editor

⧩ vercel. com
// Free hosting

⧩ dev. to
// Daily articles about web development(and more)

⧩ fun-javascript-projects. com
// Learn JavaScript by building projects

What would you add?
Added by some nice people in the comments:

hashnode.com, by @TheAnkurTyagi
tailwindcomponents.com, by @schandra1008
brumm.af/shadows, by @joe_dyer1
heroicons.dev, @d_mstern
w3.org, by @NoureddineTale4
Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!