From 4f3e7564786397f254e8e1105e487b8897d61018 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 May 2022 15:35:44 +0530 Subject: [PATCH] updated SW-stage2 --- index.html | 2 +- src/app.js | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 62790f2..a2569dd 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ - Super Wars + Super Wars-stage2 diff --git a/src/app.js b/src/app.js index cc43cc2..01bbaa9 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