I am fairly new to JS and the world of web development, so apologise in advance if my question is a bit tedious.
I wrote this code:
var breakfast = new Object();
breakfast.food = "croissant";
breakfast.extra = ["mushroom", "cheese"];
breakfast.eat = function(){return this.food + " with " + this.extra[0];}
var elBreakfast = document.getElementById("breakf");
elBreakfast.textContent = breakfast.eat();
I get an error message from the browser:
"Uncaught TypeError: Cannot set property 'textContent' of null"...
What have I done wrong?
Thanks!