0
I am stuck in creating logic for the following question in description
Problem Statement: Create an array of objects having movie details. The object should include the movie name, language, and ratings. Render the details of movies on the page using this array. https://code.sololearn.com/W12mPbB0E3or/?ref=app
4 ответов
+ 3
I added movie title field inside each movie object to allow display of it
window.onload = () =>
{
const foursoldiers = { mName0 : "Four Soldiers", lang0 : "english" , rating0 : 3.1 };
const tommowrowland = { mName1 : "Tomorrow Land", lang1 : "english" , rating1 : 3.2 };
const thehungergames = { mName2 : "The Hunger Games", lang2 : "english" , rating2 : 3.6 };
const arrmovie = [ foursoldiers, tommowrowland, thehungergames ];
for( const movie of arrmovie.values() )
{
for( const key in movie )
{
document.querySelector( `#${ key }` )
.textContent = movie[ key ];
}
}
};
Nice code BTW
+ 1
That was great logic
Thanx for help
0
Can you describe or illustrate how the movies' information was to be rendered on the page?
Just an FYI, you'd need to enclose the JS code in a "onload" event handler function when previewing the code in SoloLearn app. But it's not necessary when previewing through SoloLearn web interface.
0
I have to update the info in array in the span id named lang0 , lang1, rating1 and rating2