Javascript console.log Tips ..#javascripttutorial #javascript #shorts

preview_player
Показать описание
Here is a simple trick to console log variables along with their name easily 😎

⚠️ NOTE: Try to use debuggers for debugging, which is much easier than console logging. But you may want to use console logging for simple log outputs.

You might be used to wrapping the variables in a string and then printing them.

But a much easier approach is to wrap it in a object and print the object itself.

Thanks to object shorthand assignment, instead of having to create the object like

{ a: a, b: b }

We can use the shorter syntax:

{ a, b }

That is, when the property name is same as the value you are assigning to it, you can skip the variable 🤩

Did you find this trick helpful? Let me know in the comments! 💬

#javascript
#nodejs
#html
#css
#html5
#programming
#reactjs
#vuejs
#frontenddeveloper
Рекомендации по теме