I’m a complete novice to programming and am working my way through the book Learning to Program, by Steven Foote. I am trying to find out why Chrome is telling me I’ve got these two errors:
Uncaught TypeError: Cannot read property ‘currentDate’ of undefined
Uncaught TypeError: Cannot read property ‘projectName’ of undefined
This is what I've written:
values.js
var kbValues = {
projectName: 'kittenbook',
versionNumber: '0.0.1',
currentDate: new Date(),
currentTime: [kbValues.currentDate.getFullYear() + '-' +
(kbValues.currentDate.getMonth() + 1)+ '-' +
kbValues.currentDate.getDate() + ' at ' +
kbValues.currentDate.getHours() + ':' +
kbValues.currentDate.getMinutes() + ':' +
kbValues.currentDate.getSeconds()]
};
kittenbook.js
document.body.innerHTML = '<h1>Hello, ' + userName + '!</h1>' +
'<p>' + kbValues.projectName + '' + kbValues.versionNumber +
' accessed on: ' + kbValues.currentTime + '</p>';
manifest.json
{
"manifest_version": 2,
"name": "kittenbook",
"description": "Replace photos on Facebook with kittens",
"version": "0.0.1",
"content_scripts": [
{
"matches": ["*://www.facebook.com/*"],
"js": ["js/values.js","js/kittenbook.js"]
}
]
}
I'm really very new to this.