Coding Challenge: Handling Classes
Let's write a function that will take two parameters and return a particular element belongs to the given class.
We'll cover the following
Problem statement
Write a has()
function that tests if an element designated by its ID has a class. The function shows true
, false
or an error message ID not found
if the element can’t be found.
Note: Before testing your code, please run the code by pressing
RUN
button. Then, you can clickTEST
button. Otherwise, the test cases won’t pass even if the code is correct.
Get hands-on with 1400+ tech skills courses.