Filter
Exclude
Time range
-
Near
JavaScript array methods πŸš€πŸ”₯ 1. Adding & Removing Elements push(item) β†’ Adds an item at the end of the array. pop() β†’ Removes the last item from the array. unshift(item) β†’ Adds an item at the beginning of the array. shift() β†’ Removes the first item from the array. ----------------------------------------------------- 2. Searching in an Array indexOf(item) β†’ Returns the index of the first occurrence of an item (or -1 if not found). lastIndexOf(item) β†’ Returns the index of the last occurrence of an item. includes(item) β†’ Returns true if the item exists in the array, otherwise false. find(callback) β†’ Returns the first matching element based on a condition. findIndex(callback) β†’ Returns the index of the first matching element based on a condition. ----------------------------------------------------- 3. Modifying or Transforming Arrays map(callback) β†’ Creates a new array by modifying each item. filter(callback) β†’ Creates a new array with only the items that match a condition. reduce(callback, initialValue) β†’ Reduces the array to a single value (e.g., sum of all numbers). forEach(callback) β†’ Runs a function for each item (but doesn’t create a new array). some(callback) β†’ Returns true if at least one item matches a condition. every(callback) β†’ Returns true if all items match a condition. ----------------------------------------------------- 4. Sorting & Reversing sort(compareFunction) β†’ Sorts the array (default is ascending, but can be customized). reverse() β†’ Reverses the order of the elements in the array. ----------------------------------------------------- 5. Extracting & Combining Arrays slice(start, end) β†’ Extracts a portion of an array (without modifying the original). splice(start, deleteCount, item1, item2, …) β†’ Changes the array by adding/removing elements. concat(array2, array3, …) β†’ Joins two or more arrays into a new array. flat(depth) β†’ Flattens nested arrays into a single array (default depth is 1). join(separator) β†’ Converts an array to a string, with elements separated by a given character. ----------------------------------------------------- 6. Converting & Checking Arrays toString() β†’ Converts an array to a string. Array.isArray(value) β†’ Checks if a value is an array (true or false). #JavaScript #JSDeveloper #LearnJavaScript #JavaScriptTutorial #Coding #JavaScriptArrays #ArrayMethods #JSArrayTips #CodingWithJS #JavaScriptTricks #WebDevelopment #coder #CodeNewbie #FrontendDeveloper #coding #ProgrammingTips #100DaysOfCode #react
25
7
39
2,876
Common String Methods πŸš€ indexOf(substring): Finds the first occurrence of a substring. console.log(str.indexOf("l")); // Output: 2 slice(start, end): Extracts part of a string. console.log(str.slice(1, 4)); // Output: "ell" #ES6 #JavaScriptFunctions #JavaScriptEvents #AsyncJavaScript #Promises #JavaScriptArrays #DOMManipulation #JavaScriptObjects #JavaScriptProjects
1
3
37
Removing elements:πŸš€ pop(): Removes the last element. shift(): Removes the first element. #ES6 #JavaScriptFunctions #JavaScriptEvents #AsyncJavaScript #Promises #JavaScriptArrays #DOMManipulation #JavaScriptObjects #JavaScriptProjects
1
2
45
πŸš€ Day 71 of #100DaysofCode: - Solved one LeetCode problem. πŸ’ͺπŸ† - Learned about array methods in JavaScript. πŸ”’πŸ’‘ #LeetCodeVictory #JavaScriptArrays #CodeJourney
3
40
πŸš€ Day 63 of #100DaysofCode: - Solved three LeetCode problems. πŸ’»πŸ† - Revisited array concepts in JavaScript. πŸ”’πŸ“š #LeetCodeVictory #JavaScriptArrays #CodeJourney
2
48
πŸš€ Day 21 of #100DaysofCode: - Explored the depths of arrays in JavaScript and Explored techniques for dynamically generating HTML with JS.πŸ’»πŸŒ - Solved One LeetCode problem.πŸ’ͺπŸ† #JavaScriptArrays #HTMLGeneration #LeetCodeChallenge #CodeJourney
6
83
πŸŽ‰ Day 26 (today): Leveled up with arrays in JavaScript! πŸš€ Mastered slice, reverse, join, concat, and dived into operations with 2D arrays. πŸ’‘ Unlocking new possibilities with array manipulation techniques. πŸ’»βœ¨ #JavaScriptArrays #AdvancedTechniques #WebDevJourney πŸŒŸπŸ”
1
28
10 Jan 2024
Arrays and their methods are fundamental in JavaScript, enabling efficient data handling and operations on collections of values. Dive into arrays and discover the plethora of functionalities they offer! Stay tuned for more JavaScript insights! #JavaScriptArrays #coding #react
2
36
30 Nov 2023
JavaScript Array Methods Quiz! πŸ“Š JavaScript enthusiasts, here’s a question for you! Which method removes the last element from an array and returns that element? A) pop() B) push() C) shift() Write your answer below! πŸ–‹οΈ Avoid Googling! 🚫 #JavaScriptArrays #CodingQuestions #DevBrainTeasers #html #css #javascript
12
9
995
12 Nov 2023
πŸŒ… Good morning, Code Explorers! Today, we’re diving into one of the most versatile data structures in #JavaScript - Arrays. πŸš€πŸ“Š Arrays are like containers that hold a collection of items. Each item in an array has a position, known as its index, which starts at 0. Here’s what makes arrays powerful: 1. Storing Multiple Values: You can store a list of values, even of different types, in a single variable. let mix = ['Hello', 10, true]; 2. Accessing Elements: Use the index to access or modify items in the array. let fruits = ['Apple', 'Banana', 'Cherry']; console.log(fruits[1]); // Banana 3. Common Methods: β€’.push(): Add an item to the end. β€’.pop(): Remove the last item. β€’.shift(): Remove the first item. β€’.unshift(): Add an item to the beginning. β€’.length: Find out how many items are in the array. 4. Iterating Over Arrays: Use loops like for or forEach to go through each item. fruits.forEach(fruit => console.log(fruit)); 5. Flexibility: Arrays in JS can grow and shrink dynamically, making them very flexible to use. πŸ” Arrays are crucial for handling lists of data in web applications, from displaying product listings to managing user inputs. Stay tuned as we explore more on how to manipulate and effectively use arrays in real-world scenarios! #JavaScriptArrays #WebDevelopment #LearnToCode
1
4
172
πŸŽ¨πŸ”JavaScript Manipulating Arrays! πŸš€πŸ”’ In the realm of JavaScript, with an array of captivating methods, you can effortlessly manipulate data to create coding masterpieces. πŸ”„ .map(): Unleash the artistry of .map() to transform your array into something extraordinary! πŸŒˆπŸ–ŒοΈ This method applies a provided function to each element in the array, returning a new array with the results. πŸŽ¨πŸ’‘ It's perfect for modifying data and creating a fresh canvas of transformed elements. πŸ” .filter(): Become a code detective with .filter()! πŸ§πŸ”Ž This method examines each element in the array, keeping only those that meet a specified condition. πŸ•΅οΈβ€β™‚οΈπŸ’Ž It's like finding hidden gems in your data and presenting them in a brand-new array. πŸ“ .fill(): Paint your array with the colors of your choice using .fill()! 🎨✨ This method changes all the elements in an array to a static value, giving you the power to quickly populate and customize your array. πŸ” .find(): The quest for specific elements is made easy with .find()! πŸŒŸπŸ—ΊοΈ This method returns the value of the first element in the array that satisfies a provided testing function. It's like embarking on a treasure hunt and discovering the desired element you seek. πŸ”’ .indexOf(): Lost in the array? Fear not, .indexOf() comes to the rescue! πŸ§­πŸ” It returns the index of the first occurrence of a specified value within the array, guiding you to the location of the element. πŸ‘€ .some(): Get a taste of excitement with .some()! 🎑🎒 This method checks if at least one element in the array meets a given condition, offering a thrilling way to validate data. βœ… .every(): Join the league of array validators with .every()! πŸ…πŸ’Ό This method checks if all elements in the array satisfy a condition, enabling you to ensure consistency and validity in your data. Credit goes to the respected owner(s) πŸ”₯ Join Amigoscode today for premium programming courses -Β bit.ly/40ujtvS #javascriptarraysΒ #arraymanipulationΒ #arraymethodsΒ #javascriptdeveloper #javascriptdevelopersΒ #javaarraysΒ #amigoscode
2
38
181
14,746
Unleash the Power of Arrays in JavaScript! πŸ’ͺ🌐 #JavaScriptArrays #CodeMagic #100DaysOfCode #javascript
2
3
122
List of Javascript Array Methods. Save this post for future use. If you found this post helpful, don't forget to share it with your friends and colleagues. For more updates follow @codegaragetech #codegaragetech #cgt #javascript #javascriptarrays #typescript #reactjsdeveloper
3
38
Replying to @ShahzaibOG11
This thread is saved to your Notion database. Tags: [Javascript, Javascriptarrays]
4
Javascript arrays can contain duplicates - which is fine most of the time, but can sometimes cause some issues. - by @smpnjn hackernoon.com/how-to-remove… #webdevelopment #javascriptarrays

1
3
973
3
11
656