DEV Community

Robert Mion
Robert Mion

Posted on

1 fish, 2 fish, #red fish, .blue fish

A lesson in Frontend Development from Dr. Seuss.

1 fish

Right

document.querySelector('fish');

Wrong

document.getElementById('#fish');

2 fish

Right

document.querySelectorAll('.fish');

Wrong

document.querySelector('.fish');

#red fish

Right

document.getElementById('red');

Wrong

document.getElementById('#red');

.blue fish

Right

document.getElementsByClassName('blue');

Wrong

document.getElementsByClassName('.blue');

Pay close attention to the method you use and the query string you pass as argument.

Get more practice by playing this free game I made each day: Fix a function!

Top comments (0)