Why does console.log prints only single element of object?


Hello Friends,

I appreciate if any one of you guide me .
I have two doubts.
#1 Why do console.log doesnt print all object values. It prints only second value in my case here(i.e 'Shishya').
how to print all values using console.log?

2 Why do console.log written after array creation doesnt display all array contents.?

In my case the all array elements are displayed except the object created in array.
Why is the term object displayed insteda y not the contents of the object are displayed?

For better understanding plz find my code below

var Gyan = {
Gyan: "Guru",
Gyan: "Shishya"
// Why is "Guru not printed"

var newArray = [[5,6,7],["Avatar","Yoga","Veda",[Gyan]]];
console.log(newArray) ;
// Why are not the contents of object Gyan are printed in the array? Instead why does the string "object " is printed in array?

thanks in advance



Try using something like

var goyan = { a:1 }
var myArray=[[1,2],[1,2,3,[goyan]]]
console.log( myArray[1][3] )