Michael Douglas Brett - Web Development

Hi, I'm Michael. I'm a front-end web developer based in the UK. This is my site.

Front End Developer Interview Questions


Mar 2nd 2016

The repo Front End Development Interview Questions (FEDIQ) is a pretty famous one - starred over 20k times and even featured on an episode of The Changelog. I've mooched through it once or twice and absent-mindedly had a stab at answering the questions, generally responding to things like 'What does a doctype do?' with 'oh, you know...' and then just moving on to the next question or clicking away to something else. Everyone knows what a doctype does anyway...

Are the FEDIQ for me? I don't go on any interviews, and surely I've got more on my plate than spending time answering questions for hypothetical interviews I'm not taking. But I do have a blog, and one of the most common questions asked on ShopTalk is 'What should I blog about?'. Plus, it never hurts to brush up on your knowledge. Also, what DOES a doctype do, really?

So, I've decided to use the FEDIQ as a framework for posts on this site. It'll be educational and entertaining (for me), and removes that inertia of trying to come up with a blog post topic. The questions themselves are split into nine categories:

If I tackle one a week on a rotational basis, that should see me write at least 140 posts (and that's excluding anything that bubbles up in the meantime). That's over 2.5 years of content!

I could say that I'll start next week, but that's a bit of a cop-out. So without further ado...

What does a doctype do?

Let's go to the spec. The HTML 5 Spec tells me that a doctype helps the browser make a 'best-effort attempt' at rendering the page to the 'relevant specifications'. What this means is that the doctype declaration (or lack thereof), tells the browser whether the page should be rendered using Standards, Almost Standards or Quirks mode. Each of these have implications on the parsing, scripting or layout (mostly layout) of the document (to a lesser or greater degree).

To enable Standards mode for HTML pages (which you almost definitely want to do), make sure that you put this line at the very top of your page (case insensitive):

<!doctype html>

However, you might still want to have a little trip to Can I Use? to further limit the chances of running into any surprising behaviour.

One down, quite a few to go...