0% found this document useful (0 votes)
105 views

ChatGPT Prompts

This document provides 5 prompts to help JavaScript developers with common productivity and problem-solving tasks like understanding code, improving code quality, fixing issues, writing comments, and using third-party libraries. Each prompt describes a scenario and asks ChatGPT to help explain code, improve the code, identify and fix errors, write comments, or write code using a specific library.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views

ChatGPT Prompts

This document provides 5 prompts to help JavaScript developers with common productivity and problem-solving tasks like understanding code, improving code quality, fixing issues, writing comments, and using third-party libraries. Each prompt describes a scenario and asks ChatGPT to help explain code, improve the code, identify and fix errors, write comments, or write code using a specific library.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Double Your Output with

These 5 JavaScript
Productivity Prompts

Chetan Mahajan
@_chetanmahajan
1. Understand the given code.

Due to the changing nature of JavaScript, it


can be difficult to understand legacy or new
code. You can use this prompt to understand
the given code.

Prompt :

I am unable to understand the given code,


Explain each variable, function, and logic in
the given code in detail.

Code: [paste your code here]

Chetan Mahajan
@_chetanmahajan
2. Write better code

There are different ways to write JavaScript


programmes. Using ChatGPT, you can use
the following prompt to write better code:

Prompt :

Act like an experienced JavaScript


Programmer, Improve the code quality of the
given code; it should be readable, reusable,
scalable, and secure.

Code: [paste your code here]

Chetan Mahajan
@_chetanmahajan
3. Fix the JavaScript issues

Sometimes it takes hours to understand the


JavaScript issue due to different types of
syntax. ChatGPT can help you understand the
issue in a few minutes by using the following
prompt:

Prompt :

I am getting the error message [paste your


error message or explain the issue]. Explain
the issue in the short and tell me how to fix it
with updated code and steps.

Chetan Mahajan
@_chetanmahajan
4. Writing comments

Writing comments in code is good practice


because it helps explain your thought
process, making it easier for others (and
yourself) to understand and maintain the
code later. Here is the prompts to write
comments for your JavaScript code.

Prompt :

Write a short and easy-to-understand


comment for the given code.

Code: [ paste your code ]

Chetan Mahajan
@_chetanmahajan
5. Write code for third party libraries
As a JavaScript developer, there are
hundreds of thousands of libraries available
on the internet. It is very time consuming to
learn about them if you want to use one in
your project. Here is the best way to write
code in a few minutes.

Prompt:

Help me write code with the given library or


package.

Library: [package or library name]

Version: [package or library version]

Task Description: [enter your task


description]

Chetan Mahajan
@_chetanmahajan
Enjoyed this post?

Feel free to save and share it with others!

Chetan Mahajan
@_chetanmahajan

You might also like