Objects inside arrays (JavaScript)
Hello everyone!
I started learning JavaScript and noticed that I can't output not the name not the contents of the object that is inside the array
Code:
init = function() {
var myWork =[];
let i=1;
for(i;i<=10;i++){
var lesson ={
name: "Lesson " + i,
status: i%2 ? "true" : "false"
};
myWork.push(lesson);
}
print(myWork);
}
Console:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
If you look through the browser console, everything is fine there, maybe it's a bug?
If so, how about making it look like this:
cell number
Item name: value,
Item name: value,
Item name: value
cell number
Item name: value,
Item name: value,
Item name: value
Or in this form:
(cell number) {element name: value, element name: value}
(cell number) {element name: value, element name: value}