Hello, I am Antonio and I live in Milan Italy 🏠 I am a developer 👷 who enjoy build web apps 🌍
Sometimes I build small videogames 👾 I also like time traveling 🕰️
console.log is useful.
Specially if you can't stop the code execution with breakpoints because you are debugging async code, or when you need to print some info in the console often and you don't want stop the code execution each time.
On the contrary, console.log() is actually not useful for async functions since it is non-blocking i.e. the result would be pending. If you want to console.log() async code, you would have to either precede the method with await or chain it with then. In this scenario, a breakpoint would be more efficient.
For readers who are unaware:
An asynchronous call requests a transfer that will be performed in its whole(entirety) but will complete at some future time.
Nevertheless, I do agree that printing some info into the console without stopping the code execution each time is useful depending on the situation.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
console.log
is useful.Specially if you can't stop the code execution with breakpoints because you are debugging async code, or when you need to print some info in the console often and you don't want stop the code execution each time.
Thanks for reading Antonio!
On the contrary,
console.log()
is actually not useful for async functions since it is non-blocking i.e. the result would be pending. If you want to console.log() async code, you would have to either precede the method with await or chain it with then. In this scenario, a breakpoint would be more efficient.For readers who are unaware:
Nevertheless, I do agree that printing some info into the console without stopping the code execution each time is useful depending on the situation.