Tell us what’s happening:
Hello,
I have tried several times with Q24 but without success; could you please help me?
“You should remove the earlier logic calculating the area of a circle with the variables.”
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: index.ts */
// User Editable Region
const resultCard = document.getElementById("result-card")!;
const resultText = document.getElementById("result-text")!;
interface Shape {
type: string;
}
interface Circle extends Shape {
type: "circle";
radius: number;
}
interface Rectangle extends Shape {
type: "rectangle";
width: number;
height: number;
}
interface Triangle extends Shape {
type: "triangle";
base: number;
height: number;
}
type Shapes = Circle | Triangle | Rectangle;
const getElement = (id: string): HTMLElement => {
const el = document.getElementById(id);
if (!el) throw new Error(`Element not found: ${id}`);
return el;
};
let shapeTypeSelect: HTMLSelectElement;
let propertyGroups: {
circle: HTMLElement;
rectangle: HTMLElement;
triangle: HTMLElement;
};
let propertyInputs: {
radius: HTMLInputElement;
width: HTMLInputElement;
height: HTMLInputElement;
base: HTMLInputElement;
triangleHeight: HTMLInputElement;
};
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36