Visualising documentation: JavaScript array.from

charlottebrf_99

Charlotte Fereday

Posted on August 28, 2020

Visualising documentation: JavaScript array.from

Alt Text

Today’s function is array.from(), mdn description here.

This function creates an array from whatever it has been given.

For example, if you give it a string it will split the string into chars and build an array from that. You could also give it an existing array and a function, and it will create a new array from the results of applying the function to each item in the original array.

For this second use case, it's interesting to consider when to use array.from() vs array.map(). Would welcome any comments :)

I've done my own version of the docs with sketches together. Here’s the folder for array.from. Check out the readme to see how you can run the examples.

💖 💪 🙅 🚩
charlottebrf_99
Charlotte Fereday

Posted on August 28, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related