An interactive, comprehensive guide to JavaScript array manipulation methods with live code playground
- 30+ JavaScript array methods organized by category
- Search & Test:
includes
,indexOf
,find
,some
,every
, and more - Transform:
map
,filter
,reduce
,flat
,flatMap
, and more - Extract:
slice
,splice
, and more - Modify:
push
,pop
,shift
,unshift
,sort
,reverse
, and more - Iteration:
forEach
,keys
,values
,entries
, and more - Conversion:
join
,toString
,toLocaleString
, and more - Creation: Static methods like
Array.from
,Array.of
,Array.isArray
- Live code editor with syntax highlighting
- Real-time execution with instant feedback
- Copy & run functionality for easy experimentation
- Error handling with clear error messages
- Output visualization for better understanding
- Dark/Light theme support with smooth transitions
- Responsive design that works on all devices
- Beautiful animations and hover effects
- Intuitive navigation with categorized method lists
- Search functionality to quickly find methods
- Multi-language support infrastructure
- Currently supports English with easy expansion
- Context-aware translations for all UI elements
- Node.js 18+
- npm, yarn, or pnpm
# Clone the repository
git clone https://github.com/DevTwitter/js-array-methods.git
# Navigate to the project directory
cd js-array-methods
# Install dependencies
npm install
# or
yarn install
# or
pnpm install
# Start the development server
npm run dev
# or
yarn dev
# or
pnpm dev
Open http://localhost:3000 in your browser to see the application.
js-array-methods/
├── app/ # Next.js app directory
│ ├── layout.tsx # Root layout component
│ └── page.tsx # Home page
├── components/ # React components
│ ├── ui/ # Reusable UI components
│ │ ├── button.tsx
│ │ ├── card.tsx
│ │ ├── input.tsx
│ │ └── ...
│ ├── code-playground.tsx # Interactive code editor
│ ├── array-methods-explorer.tsx # Main explorer component
│ └── theme-toggle.tsx # Theme switcher
├── lib/ # Utility libraries
│ ├── i18n/ # Internationalization
│ │ ├── config.ts
│ │ ├── context.tsx
│ │ └── translations/
│ └── array-methods.ts # Array methods data
├── styles/ # Global styles
│ ├── globals.css
│ └── highlight.css
└── public/ # Static assets
- Next.js 15.2.4 - React framework with App Router
- React 19 - UI library
- TypeScript 5 - Type safety
- Tailwind CSS 3.4.17 - Styling
- Radix UI - Accessible component primitives
- Lucide React - Beautiful icons
- Class Variance Authority - Component variant management
- Highlight.js - Syntax highlighting
- react-simple-code-editor - Code editor component
- ESLint - Code linting
- PostCSS - CSS processing
- next-themes - Theme management
Methods for searching and testing array content:
includes()
- Check if array contains elementindexOf()
- Find first occurrence indexlastIndexOf()
- Find last occurrence indexfind()
- Find first element that satisfies conditionfindIndex()
- Find index of first element that satisfies conditionsome()
- Test if at least one element passes testevery()
- Test if all elements pass test
Methods for transforming array data and structure:
map()
- Create new array with transformed elementsfilter()
- Create new array with filtered elementsreduce()
- Reduce array to single valuereduceRight()
- Reduce array from right to leftflat()
- Flatten nested arraysflatMap()
- Map and flatten in one operation
Methods for extracting parts of arrays:
slice()
- Extract portion of arraysplice()
- Remove/add elements in place
Methods for modifying and manipulating arrays:
push()
- Add elements to endpop()
- Remove last elementunshift()
- Add elements to beginningshift()
- Remove first elementreverse()
- Reverse array in placesort()
- Sort array in placefill()
- Fill array with static valuecopyWithin()
- Copy elements within array
Methods for iterating over array elements:
forEach()
- Execute function for each elementkeys()
- Get array indicesvalues()
- Get array valuesentries()
- Get key-value pairs
Methods for converting arrays to other formats:
join()
- Join elements into stringtoString()
- Convert to stringtoLocaleString()
- Convert to locale-specific string
Static methods for creating arrays:
Array.from()
- Create from array-like objectArray.of()
- Create from argumentsArray.isArray()
- Check if value is array
- Browse Methods: Use the categorized sidebar to explore different array methods
- Search: Type in the search box to quickly find specific methods
- Learn: Read syntax, examples, and descriptions for each method
- Experiment: Use the code playground to modify examples and see results
- Practice: Copy code snippets and run them in your own environment
- Syntax Highlighting: JavaScript code is highlighted for better readability
- Live Execution: Click "Run" to execute code and see output
- Error Handling: Clear error messages help debug issues
- Copy Functionality: Easy copying of code examples
- Real-time filtering as you type
- Case-insensitive search
- Category-based organization
- No results state with helpful suggestions
- Mobile-first approach
- Adaptive layouts for different screen sizes
- Touch-friendly interface elements
- Optimized for both desktop and mobile
- Keyboard navigation support
- Screen reader friendly
- High contrast mode support
- Focus management for better UX
- Code splitting for faster loading
- Optimized bundle size
- Lazy loading of components
- Efficient re-renders
We welcome contributions! Here's how you can help:
- Use the GitHub issue tracker
- Provide clear reproduction steps
- Include browser and OS information
- Open an issue with the "enhancement" label
- Describe the feature and its benefits
- Consider implementation complexity
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Add method data to
lib/array-methods.ts
- Include syntax, example, and expected result
- Add description to
lib/i18n/translations/en.ts
- Test in the playground
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- JavaScript Community - For the amazing array methods
- MDN Web Docs - For comprehensive documentation
- Next.js Team - For the excellent framework
- Radix UI - For accessible components
- Tailwind CSS - For the utility-first CSS framework
Check out our companion project for JavaScript string manipulation:
Features:
- 40+ JavaScript string methods with interactive examples
- Live code playground for experimentation
- Comprehensive documentation with syntax and examples
- Modern UI with dark/light theme support
Links:
- 🌐 Live Demo - Try it online
- 📚 GitHub Repository - View source code
If you find this dataset useful or enjoy the content from the DevTwitter channel, please consider supporting us:
Your support helps us maintain the channel and continue sharing valuable programming content with the community.
- GitHub Issues: Report bugs or request features
- Discussions: Join the community
- Contact: DevTwitter
⭐ Star this repository if you found it helpful!
Made with ❤️ by DevTwitter