How do I select the strings in the randomImage.images array from my randomImage.imagePicker method?
(function() {
var randomImage = {
images : [
'http://placehold.it/100x100',
'http://placehold.it/200x200',
'http://placehold.it/300x300',
'http://placehold.it/400x400'
],//images Array
imagePicker : function () {
return console.log(randomImage.images[2]);
}()//imagePicker Method
}//randomImage Object
})()
I get the following error in the console:
Uncaught TypeError: Cannot read property 'images' of undefined
randomImage.images[2]accesses the third element in the array. Not sure what your issue is?