Converting Object into Array

To convert an object into an array in javascript is really simple. Just use  Object.entries().  In the codes below i will show you few examples how you can learn to manipulate objects and arrays. I hope this will assist you to learn Javascript better

    const info = {
        name:’Justin yaw’,
        age:42
    }
 console.log(info.name); // This is accessing your object attribute
 console.log(info) // Consoling the all the object
 // Printing out keys in object
 let keys = Object.keys(info);
 console.log(keys);  // Printing out keys
 // Printing out values
 let value = Object.values(info);
 console.log(value);
 //Changing object to array
 let myarray =Object.entries(info);
 console.log(myarray);
 //Printing single array value
 console.log(myarray[0]);   //output name name Justin Yaw
 console.log(myarray[1]);  //output age  age 42