Click here to Skip to main content
15,390,185 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am a beginner in Javascript (and programming) and am tasked with creating a function that will convert an array of objects into an array of arrays.

I have one array with many objects inside , which consist of movies and their data such as genres, actors, descriptions etc.

I need to create a function which will convert this array of objects :

var movieInfo = [
actors: [
{ firstName: "Elijah", lastName: "Wood" },
{ firstName: "Ian", lastName: "McKellen" },
{ firstName: "Viggo", lastName: "Mortensen" }

to an array of arrays and then log the actors names to the console.

I've tried using Array.from() method but as i don't really understand it yet it hasn't done the trick.

Thank you in advance.

What I have tried:

loop through the array, and tried Array.from on the objects within the array
Updated 13-Jan-18 18:56pm
Richard Deeming 16-Jan-18 13:19pm
What is the expected output?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900