Prompt Details
Model
Chat - (gpt-5)
Token size
348 ($0.01088 / call)
Example input
[PASTE YOUR CODE HERE]: // Code snippet for a simple web calculator function function add(a, b) { return a + b console.log("Calculation done"); }
[PROJECT TYPE/DESCRIPTION]: Simple web calculator
[PREFERRED PROGRAMMING LANGUAGE]: JavaScript
[ANY SPECIAL REQUIREMENTS OR LIMITATIONS]: Must run without external libraries
Example output
Alright, here’s my “vibe-friendly” review of your calculator function:
🛑 Bugs & Issues Found
Line 3 – console.log("Calculation done"); is never executed because it comes after return. Once you return, the function exits.
No input type safety – if a or b aren’t numbers, + might concatenate strings instead of adding.
🔧 Suggested Fixes
javascript
Kopiuj
Edytuj
function add(a, b) {
const sum = Number(a) + Number(b) // ensure numeric addition
console.log("Calculation done") // moved before return
return sum
}
Changes:
Converted inputs to numbers with Number() to avoid accidental string concatenation.
Moved console.log before return so it actually runs.
💡 Quick Wins
Add default parameters so add() doesn’t blow up if called with missing args:
javascript
Kopiuj
Edytuj
function add(a = 0, b = 0) { ... }
Make the log a little more “vibey” to keep the fun factor:
javascript
Kopiuj
Edytuj
console.log(`✨ Added ${a} + ${b} = ${sum}`)
⚠️ Caution
If you keep accepting raw user input from HTML form fields, they’ll come in as strings. Without Number() conversion, "2" + "3" will give "23", not 5.
Avoid trusting direct user input if you ever expand this beyond just a toy project — input sanitization will matter.
If you want, I can also give this function a tiny performance-friendly tweak that still keeps the “light and fun” vibe. That would make it future-proof for more operations.
By purchasing this prompt, you agree to our terms of service
GPT-5
This prompt turns AI into your chill senior-dev teammate — reviewing your vibe-coded projects for bugs, security issues, and quick wins without killing your creative flow. Get clean, working code and practical fixes, all in a friendly, no-nonsense tone.
...more
Added over 1 month ago
