Enhance Your Code With ChatGPT
This revolutionary new tool that everybody can use, really can help us coding, follow me to know about these techniques that our friend ChatGPT can help us with.
1. Prettify your Code
ChatGPT is so powerful that it can code easily, check this out! I’m going to add some easy code and therefore ChatGPT will help me prettify my code:
const one = 1, two = 2, name = ‘Medium’
const simpleFunction = ( str ) => {
console.log( `Print in console: ${ str }` )
}
As you see, it helps prettier all my code, and it looks great at the final answer
2. Debugger
Yes, ChatGPT can debug our code and help you with some mistakes, it will help you if you have a massive project, and you need to work fast but be careful, your information is not secure and also always be carefully not to share sensitive or private data.
// Errors
const errorfunction () => {
console.log(‘this is an error’)
}
lett a = ‘a’
const changeName = ‘hllo’
consol.log( changeName )
After I added small mistakes, it looks that it fixed all of them and in addition added the information really good!
3. Generate Code
Well for now it was awesome but what is happening is, if you can use it as your new Assistance to create code in seconds or if you have an idea of creating something you can tell to ChatGPT to start the project? This is really cool! Let’s go to the practice:
3.1 Generate an Express.js starting point
3.2 Generate a small HMTL form with JavaScript fetch code
Looks great right! Well, all of this was created with ChatGPT and it is still great!
4. Explain concepts
If you really want to take advantage of ChatGPT and its world, you can start asking about concepts, differences, new libraries etc. it will save you a little time, for sure!
4.1 Differences between remove method and removeChild method
As you see again everything is explained and in a nutshell.
5. Refactoring code
ChatGPT can refactor code, and it will set in a descriptive manner
const sumTwo = ( a, b ) => {
return a + b
}
const minusTwo = ( a, b ) => {
return a — b
}
6. Comment Code
Another incredible and handy use is that you can ask to comment your code and ChatGPT it will do it in a neat way.
Let’s use our past simple code
Conclusion
The new AI era is coming and if you want to improve with the new AI tools this can be a small step to do it and of course testing and working alongside with your new friend ChatGPT will be great! Don’t hesitate about testing new tools, this can be a great start to a new way to develop your new project in this case ChatGPT help us out with some way to improve coding in the best and funny way.