I am trying to randomize the movie titles from an movie API and I keep getting the first letter of the title instead of the actual movie title
function renderMovie(jsonObject) {
let arrayTitle = jsonObject.movie_results;
arrayTitle.forEach((title) => {
let movieGenre = document.getElementById("movie-description");
let newTitleArr = Object.values(title)[0];
let random = newTitleArr[Math.floor(Math.random() *
newTitleArr.length)];
movieGenre.innerHTML += random;
});
}
Aucun commentaire:
Enregistrer un commentaire