From 65da870421bb262125ce0da9041c8558dbacee08 Mon Sep 17 00:00:00 2001 From: manyatiwari799 <104717674+manyatiwari799@users.noreply.github.com> Date: Sun, 15 May 2022 15:08:09 +0530 Subject: [PATCH] Update app.js --- src/app.js | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/app.js b/src/app.js index cc43cc2..e69a668 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) => { @@ -41,8 +57,16 @@ const buildPlayers = (players, type) => { // Loop through players and accumulate HTML template // depending of type of player(hero|villain) - // Type your code here + + // Type your code here + for(var i=0;i
${players[i].name}
${players[i].strength}
`; + } + } return fragment; } // Display players in HTML @@ -55,4 +79,4 @@ const viewPlayers = (players) => { window.onload = () => { viewPlayers(initPlayers(PLAYERS)); -} \ No newline at end of file +}