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

18th Nov 2022, 9:04 AM
tarun kumar
tarun kumar - avatar
4 Answers
+ 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
18th Nov 2022, 10:31 AM
Ipang
+ 1
That was great logic Thanx for help
20th Nov 2022, 5:32 PM
tarun kumar
tarun kumar - avatar
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.
18th Nov 2022, 9:14 AM
Ipang
0
I have to update the info in array in the span id named lang0 , lang1, rating1 and rating2
18th Nov 2022, 9:20 AM
tarun kumar
tarun kumar - avatar