Welcome to the JavaScript Challenges Package! This package is designed to help beginners and intermediate developers learn JavaScript through practical coding exercises and programming challenges. Whether you are just starting or looking to sharpen your skills, this package provides a variety of functions and challenges to enhance your understanding of JavaScript.
- Learn JavaScript Basics: Explore fundamental concepts with easy-to-understand functions.
- Programming Challenges: Solve challenges that reinforce your learning and improve problem-solving skills.
- Well-structured Code: Clear examples and implementations to guide you through the learning process.
- Testing with Jest: Built-in tests to validate your solutions and ensure code quality.
You can install the package via npm:
npm install @ddnb/javascript
To use the functions provided in this package, simply require it in your JavaScript file:
- Import and Use the Classes in a Consumer Project
// Import specific classes
import { HelloWorld, DoorPassword } from '@ddnb/javascript';
// Or import the entire module
import * as Challenges from '@ddnb/javascript';
const helloWorld = new Challenges.HelloWorld();
helloWorld.greet(); // Output: "Hello, World!"
- If your project uses CommonJS, modify index.js to use module.exports:
// index.js (CommonJS)
const HelloWorld = require('./classes/challenges/HelloWorld.js');
module.exports = { HelloWorld };
The package includes a series of programming challenges to help you practice your skills. Each challenge is designed to address different JavaScript concepts.
Challenge: Write a function that takes an array of numbers and returns the sum.
function sumArray(arr) {
return arr.reduce((acc, num) => acc + num, 0);
}
To ensure everything is working correctly, you can run the tests included with the package. Make sure you have Jest installed, then run:
npm test
npx jest __tests__/HelloWorld.test.js
Contributions are welcome! If you have ideas for new features, challenges, or improvements, please submit a pull request or open an issue.
This project is licensed under the MIT License. See the LICENSE file for more information.
If you have any questions or feedback, feel free to reach out!
- Email: me@lehungio.com
- GitHub: @lehungio
- Challenge Me!!!