Looking to create a script that randomly changes the image source of an element with one specified in an array. However, the variable "target" keeps returning undefined. Can you help?
HTML
<ul>
<li><img src="http://www.placehold.it/20x20" /></li>
<li><img src="http://www.placehold.it/20x20" /></li>
<li><img src="http://www.placehold.it/20x20" /></li>
</ul>
JAVASCRIPT
let slideImages = [
'http://www.placehold.it/100',
'http://www.placehold.it/101',
'http://www.placehold.it/103',
'http://www.placehold.it/105',
'http://www.placehold.it/99',
'http://www.placehold.it/98',
'http://www.placehold.it/96',
'http://www.placehold.it/107'
]
let totalImages = slideImages.length;
let randomNo = Math.random() * totalImages;
let imageURL = Math.floor(randomNo)
let img = slideImages[imageURL];
let options = document.querySelectorAll('li');
let random = Math.random() * options.length;
let target = options[random];
var fadeImagesFn = (target, img) => {
console.log(img, target);
}
fadeImagesFn(img);