From a8c22ae57b529b5902c0d473f21b763531a681e4 Mon Sep 17 00:00:00 2001 From: Nile Krupa Sheel Date: Sat, 19 Mar 2022 16:54:13 +0530 Subject: [PATCH] updated --- src/app.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/app.js b/src/app.js index cc43cc2..83f6e37 100644 --- a/src/app.js +++ b/src/app.js @@ -26,14 +26,28 @@ const initPlayers = (players) => { let detailedPlayers = []; // Create players using for loop // Type your code here + for(let index=0;index{ + let random=Math.round(Math.random()) + return random===0?"hero":"villain" +} // getting random strength const getRandomStrength = () => { // Return a random integer (0,100] // Note: You can use Math.random() and Math.ceil() + return Math.round(Math.random()*100)+1 } const buildPlayers = (players, type) => { @@ -42,6 +56,16 @@ const buildPlayers = (players, type) => { // Loop through players and accumulate HTML template // depending of type of player(hero|villain) // Type your code here + for(let index=0;index + +
${players[index].name}
+
${players[index].strength}
+ ` + fragment+=temp + } + } return fragment; }