Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help #8

Open
Rupsa-11 opened this issue Jul 29, 2023 · 1 comment
Open

help #8

Rupsa-11 opened this issue Jul 29, 2023 · 1 comment

Comments

@Rupsa-11
Copy link

const stats = Object.keys(character.powerstats).map(stat => {
return <p>${statToEmoji[stat]} ${stat.toUpperCase()}: ${character.powerstats[stat]}</p>
}).join('')....can you explain this part

@HarshalMakode
Copy link

This code generates an HTML string displaying a character's power stats (like strength, speed) with emojis and values. It first gets all stat names using Object.keys(character.powerstats) and loops through them with .map(). For each stat, it retrieves the corresponding emoji from statToEmoji, converts the stat name to uppercase, and appends its value from character.powerstats. These details are wrapped in

tags and combined into a single string using .join(''), producing a neatly formatted display of stats like

💪 STRENGTH: 80

⚡ SPEED: 70

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants