diff --git a/src/app.js b/src/app.js index cc43cc2..145427b 100644 --- a/src/app.js +++ b/src/app.js @@ -26,7 +26,21 @@ const initPlayers = (players) => { let detailedPlayers = []; // Create players using for loop // Type your code here - + for(var i=0;i { const getRandomStrength = () => { // Return a random integer (0,100] // Note: You can use Math.random() and Math.ceil() + let s = Math.ceil(Math.random() * (100-1) + 1); + return s; } const buildPlayers = (players, type) => { @@ -42,7 +58,13 @@ const buildPlayers = (players, type) => { // Loop through players and accumulate HTML template // depending of type of player(hero|villain) // Type your code here - + for(var i=0;i
${players[i].name}
${players[i].strength}
`; + } + } return fragment; } // Display players in HTML @@ -55,4 +77,5 @@ const viewPlayers = (players) => { window.onload = () => { viewPlayers(initPlayers(PLAYERS)); -} \ No newline at end of file +} + diff --git a/src/style.css b/src/style.css index dfa09a8..f09ac9f 100644 --- a/src/style.css +++ b/src/style.css @@ -18,7 +18,7 @@ .player { border-radius: 5px; box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.2); - margin: 10px; + margin: 10px; padding: 1rem; text-align: center; width: 100px; @@ -42,3 +42,4 @@ margin-left: 80px; font-size: 18px; } +