The Prompt Library
CodingJavaScript

JavaScript Function Generator

Create a custom JavaScript function with parameters and error handling.

Select Model:

Prompt:

I need you to create a custom JavaScript function based on my requirements. Please generate a well-structured, production-ready function with proper error handling and documentation. FUNCTION REQUIREMENTS: - Purpose: [DESCRIBE WHAT THE FUNCTION SHOULD DO] - Function name: [PREFERRED NAME OR NAMING CONVENTION] - Parameters: [DESCRIBE PARAMETERS NEEDED] - Return value: [WHAT SHOULD THE FUNCTION RETURN] - Error handling: [SPECIFIC ERROR CASES TO HANDLE] - Browser compatibility: [ANY SPECIFIC REQUIREMENTS] Please provide: 1. COMPLETE FUNCTION CODE * Well-structured, clean JavaScript * Proper parameter validation * Comprehensive error handling * Efficient implementation * ES6+ features (unless otherwise specified) * Appropriate commenting 2. FUNCTION DOCUMENTATION * JSDoc style comments * Parameter descriptions with types * Return value description * Usage examples * Error cases documentation 3. ERROR HANDLING APPROACH * Input validation * Specific error messages * Try-catch blocks where appropriate * Error types and handling strategy * Edge case management 4. USAGE EXAMPLES * Basic usage example * Advanced usage scenarios * Error case examples * Integration examples if relevant 5. OPTIMIZATION CONSIDERATIONS * Performance notes * Memory considerations * Browser compatibility notes * Any limitations * Potential improvements Please ensure the function is robust, follows JavaScript best practices, and includes comprehensive error handling to make it suitable for production environments.

Related Prompts

Other prompts you might find useful

CodingJavaScript

JavaScript Function Generator

Create a custom JavaScript function with parameters and error handling.

6 models availableView details
CodingJavaScript

Debug a JavaScript Bug

Identify and fix issues in your JavaScript logic or syntax.

6 models availableView details
CodingJavaScript

Convert JavaScript to ES6+

Modernize older JavaScript code using ES6+ syntax and best practices.

6 models availableView details
CodingJavaScript

React Component Prompt

Generate a reusable React functional component with props and state.

6 models availableView details