Tell us what’s happening:
only step 20 denies to work for me everything else works fine
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Creature Search</title>
</head>
<body>
<input id="search-input" type="text" required />
<button id="search-button">Search</button>
<div id="creature-name"></div>
<div id="creature-id"></div>
<div id="weight"></div>
<div id="height"></div>
<div id="types"></div>
<div id="hp"></div>
<div id="attack"></div>
<div id="defense"></div>
<div id="special-attack"></div>
<div id="special-defense"></div>
<div id="speed"></div>
<script>
// Creature data
const creatures = {
"pyrolynx": {
name: "PYROLYNX",
id: 1,
weight: 42,
height: 32,
types: ["FIRE"],
stats: {
hp: 65,
attack: 80,
defense: 50,
specialAttack: 90,
specialDefense: 55,
speed: 100,
}
},
"2": {
name: "AQUOROC",
id: 2,
weight: 220,
height: 53,
types: ["WATER", "ROCK"],
stats: {
hp: 85,
attack: 90,
defense: 120,
specialAttack: 60,
specialDefense: 70,
speed: 40,
}
}
};
const button = document.getElementById("search-button");
button.addEventListener("click", () => {
const input = document.getElementById("search-input").value.trim();
const typesEl = document.getElementById("types");
typesEl.innerHTML = "";
let creature = null;
if (creatures[input]) {
creature = creatures[input];
} else if (!isNaN(input) && creatures[String(parseInt(input))]) {
creature = creatures[String(parseInt(input))];
} else if (creatures[input.toLowerCase()]) {
creature = creatures[input.toLowerCase()];
}
if (!creature) {
alert("Creature not found");
return;
}
setTimeout(() => {
document.getElementById("creature-name").textContent = creature.name;
document.getElementById("creature-id").textContent = `#${creature.id}`;
document.getElementById("weight").textContent = `Weight: ${creature.weight}`;
document.getElementById("height").textContent = `Height: ${creature.height}`;
document.getElementById("hp").textContent = creature.stats.hp;
document.getElementById("attack").textContent = creature.stats.attack;
document.getElementById("defense").textContent = creature.stats.defense;
document.getElementById("special-attack").textContent = creature.stats.specialAttack;
document.getElementById("special-defense").textContent = creature.stats.specialDefense;
document.getElementById("speed").textContent = creature.stats.speed;
creature.types.forEach(type => {
const div = document.createElement("div");
div.textContent = type;
typesEl.appendChild(div);
});
}, 100);
});
/* file: styles.css */
/* file: script.js */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0
Challenge Information:
Build an RPG Creature Search App Project - Build an RPG Creature Search App