
Learn how to use array.fill to pre-populate a JavaScript array with a value, create and modify arrays, including examples with scores initialized to zero and using optional parameters.
Address array elements with the at method using positive indices and negative indices to count from the end. Retrieve values more succinctly, and avoid assignments, which trigger a reference error.
Access an array’s length with dot syntax and see how arr[length] adds an element. Learn why changing length can create sparse arrays and when to rely on the length property.
Learn how unshift and shift add to and remove from the beginning of an array, and how this changes index positions, unlike push and pop.
Explore gathering variable function arguments into an array, convert array-like arguments to a real array, and use the spread operator to manage and sum numbers efficiently.
Learn how to convert object properties to arrays using Object.keys, Object.values, and Object.entries, turning keys, values, or key-value pairs into array formats for easier data manipulation.
Identify array-like collections in JavaScript by the iterator symbol, and implement a helper to detect array-like values for use with for-of loops on node lists and strings.
Explore when to mutate arrays in JavaScript, balancing functional principles with practical needs, and learn methods that mutate the array or create a new one, including sorting.
Master the copyWithin method to copy elements inside an array in place, specifying target index, start (inclusive), and optional end (exclusive); negative indices reference the end, and length stays unchanged.
Understand that every JavaScript array inherits methods from its prototype, a shared object attached to all JavaScript arrays, which provides copy within, pop, push, shift, and sort.
Learn to clone an array using the spread operator or Array.from to keep the original array intact while creating separate copies for sorting or reversing, preserving original order.
Clone an array with the spread operator, sort it using a comparator, and splice out specific elements, illustrating arrow function usage and method chaining.
Explore the forEach method as a replacement for for loops, mutating arrays and objects, update pass property based on scores, and square values in place.
Use the every method with a predicate function to test every element in a scores array for a condition, returning true if all pass and false otherwise.
Use the some method to check if at least one array element satisfies predicate, returning true or false, and note that it stops when a match like zero is found.
Practice exercise eight uses an array method within the process data function to convert inputs to an array of arrays and then flatten into a single array.
Learn how to pass a callback as the second argument to Array.from to process each element when converting a set to an array, including converting strings to numbers.
Learn how to represent a matrix as a multidimensional array in JavaScript, using arrays of arrays and multiple square brackets to access elements.
Build a 5x5 matrix as an array of arrays, initialize five rows with a loop, fill with row times column, and access with table[row][col], e.g., three by three equals nine.
Mastering JavaScript arrays teaches you how to combine arrays and manage elements using the spread operator, join, concat, and slice.
Explore the toString method for JavaScript arrays, which converts an array to a comma-separated string and mirrors the behavior of join.
Create a JavaScript multi-dimensional array to store the products of even numbers up to 20 in a matrix, using a two-step looping approach and display the 20 by 20 product.
Transform and combine string arrays by applying map and flatMap to split words, merge with the spread operator, join into a string, and log to the console in one line.
Discover a cleaner JavaScript solution for exercise 10 by concatenating two arrays and joining them into a single string, using concat and join while comparing to flatMap and spread operator.
Explore how indexOf and lastIndexOf locate a value in an array, returning the index when found or a negative one when not found, and how strings require exact matches.
Create a function in exercise 11 that searches an array of user objects by id using some, returning the user object or false if not found, and test it.
Explore maps and sets in JavaScript and compare them with objects as data structures. Learn when to use associative arrays and named value pairs, and how maps allow non-string keys.
Effectively working with arrays is critical for any JavaScript programmer. Arrays are an important data structure that comes native to JavaScript, and this course will provide you with the training needed to master them.
In this course you are going to learn all there is to know about JavaScript arrays. I start from the beginning, so if you are comfortable with JavaScript, you may want to use the first section as a review. You will learn the basics of different ways to create an array and work with the elements. You will learn the basics of iterating an array and some unique ways to create arrays and access elements. You will learn all the methods to modify or mutate an array, as well as those methods that are preferred in the functional programming world. You will learn how to combine arrays and extract values as well as multiple ways to search arrays for values. We will end with a look at some array-like collections available in JavaScript and how you can use those.
By taking this course:
You will feel more comfortable working with arrays in any coding problem you encounter.
You will become more familiar with functional methods for working with arrays (reduce, map, filter).
You will become familiar with and use all the different methods for manipulating an array in JavaScript.
You will be able to work with arrays using different techniques.
If you learn by doing, this course gives you plenty of chances to complete exercises and then sit back and watch as I go through those exercises. Jump in today and begin mastering JavaScript Arrays!