When I interview web developers, I always like to ask the following basic Javascript question:

Write a function in Javascript that will ‘toggle’ or show/hide an element upon being fired.

function toggle(elementIdValue) {


I typically see one of two answers: Jquery or classic JavaScript.  Both of course are effective.  But, in this article I'm going to demonstrate another way as well.