Tell us what’s happening:
Why my code is not working. This is how I would explain it
- Get element by its ID which is a parameter
- Assign the method to a variable
- Check if the variable is falsy
- if it is then throw a error.
Isn’t that what is being asked?
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: index.ts */
// User Editable Region
const getElement = (id: string): HTMLElement => {
let element = document.getElementById(id);
if(!id){
Error(`Element not found: ${id}`)
}
return element
// 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/149.0.0.0 Safari/537.36
Challenge Information:
Build a Shape Manager - Step 19