javascript - Is it unprofessional to use console.log to debug JS?
phpcn_u15822017-07-05 11:01:00
0
8
920
In the year since I taught myself front-end, I have been accustomed to using console.log to debug JS code. But isn’t this approach very amateurish? Should I stop this habit and try using the browser's debugging tools?
1. About console console implements access to the browser console. In fact, in addition to the log method, the console also has many other advanced methods. For example:
For specific usage, please refer to my blog http://www.jianshu.com/p/75cb... 2. About debugger I recommend you to use vscodeThis god-level tool, since it has I haven’t touched much about vscode and sublime. For front-end development, I personally feel that vscode is the culmination of sublime and chrome. It has rich plug-ins, easy debugging, and is very comfortable to develop.
Chrome’s network plus console debugging, I absolutely love it. There is no bug that cannot be found in one console print. If there are two, then there are two.
The goal of debugging is to solve problems. From the goal point of view, as long as it can solve the problem and save time, it is okay. Just like many people who engage in machine learning think that the front-end has no technical content, but think about it from another angle, front-end and machine learning Both can create value. In the final analysis, they all use computer basics and mathematical knowledge, which are all in logic. From this perspective, there is no difference in comparison.
This is just a personal habit, it has nothing to do with professionalism or not. I just like console.log and don't like setting breakpoints everywhere.
What is professionalism? In my opinion, professionalism is not defined by the more advanced and difficult techniques, but by adopting the most useful and effective methods under specific circumstances.
So, you must be able to use the browser’s debugging tools. However, if you can judge that console debugging is faster for specific problems, it is not unprofessional to use console.
First of all, console is also a commonly used debugging method. Secondly, it depends on your personal usage habits. You can choose between console and debugger as appropriate. In some places, you only need to look at the printed values and use console. In some places, you need to clarify the logic and use debugger
As a person who writes both background Java and front-end pages, I feel that breakpoint debugging is much more efficient. The most important thing is that it is easier to find problems
1. About console
console implements access to the browser console.
In fact, in addition to the log method, the console also has many other advanced methods.
For example:
For specific usage, please refer to my blog http://www.jianshu.com/p/75cb...
2. About debugger
I recommend you to use vscodeThis god-level tool, since it has I haven’t touched much about vscode and sublime.
For front-end development, I personally feel that vscode is the culmination of sublime and chrome. It has rich plug-ins, easy debugging, and is very comfortable to develop.
This method is much better than alert. At least you don’t have to click to close it, and it leaves the answers you need
Chrome’s network plus console debugging, I absolutely love it.
There is no bug that cannot be found in one console print. If there are two, then there are two.
The goal of debugging is to solve problems. From the goal point of view, as long as it can solve the problem and save time, it is okay. Just like many people who engage in machine learning think that the front-end has no technical content, but think about it from another angle, front-end and machine learning Both can create value. In the final analysis, they all use computer basics and mathematical knowledge, which are all in logic. From this perspective, there is no difference in comparison.
This is just a personal habit, it has nothing to do with professionalism or not. I just like console.log and don't like setting breakpoints everywhere.
What is professionalism? In my opinion, professionalism is not defined by the more advanced and difficult techniques, but by adopting the most useful and effective methods under specific circumstances.
So, you must be able to use the browser’s debugging tools. However, if you can judge that console debugging is faster for specific problems, it is not unprofessional to use console.
First of all, console is also a commonly used debugging method. Secondly, it depends on your personal usage habits. You can choose between console and debugger as appropriate. In some places, you only need to look at the printed values and use console. In some places, you need to clarify the logic and use debugger
As a person who writes both background Java and front-end pages, I feel that breakpoint debugging is much more efficient. The most important thing is that it is easier to find problems