The value != 4 is the condition for the while loop to process. As long as value does not equal (!=) 4, then it will continue prompting.
Once inside the while loop, it gets you to enter a number.
Then the number is checked (the if-else if-else) and does line following beneath it. If something other than 4 is entered, such as 2, value does not equal 4 and will prompt you to enter a number again.
This will continue until you enter 4.
I've added some comments (and braces) to the code sample, hopefully it will help clarify things...
var value = null;
while (value != "4") {//While value is not 4 do the following code
value = prompt("You! What is the value of 2 + 2?", "");//Get a value from the user
if (value == "4"){//If value equals 4, then do the following
alert("You must be a genius or something.");
}//end of if block
else if (value == "3" || value == "5"){//If value is equal to 3 or 5 then d0
alert("Almost!");
}//end of else-if block
else{//If value is something we haven't explicitly checked for, then do this
alert("You're an embarrassment.");
}//end of else block
}//End of while loop
EDIT - My response to the comment was too long
This block of code works as follows:
var value = null Create a variable named value and set it equal to null
while(value != 4){...whileblock...} (ignoring the code inside the while loop) While value is not equal to 4, then execute the whileblock code
Once we are inside the while loop (which will happen since null does not equal 4) we start operating on the additional code
value = prompt("..."); Ask the user to input something
if(value=="4"){...ifblock...}
else if(value=="3" || value=="5"){...ifelseblock...}
else{...elseblock...}
This block operates as: If value is equal to 4, do the ifblock of code. If my value is not equal to 4, then check the next component, which is if(value=="3"||value=="5"). This says, If my value is 3, or if my value is 5, then do the code in ifelseblock. If we didn't do ifelseblock then go to the next component, which is the else part. That says, whatever is in value doesn't matter, we made it this far down, so go ahead and run elseblock. (Of course, replaced each of those *block pieces with the corresponding code)
Now that it is done, the while loop returns to the top to see if we should continue executing the whileblock code. So it checks to see if value does not equal 4. If value equals 4, it won't run the loop again. If value is something other than 4, it will run all, that code again, asking for a prompt, doing the comparisons and displaying the appropriate alert box.
I hope all that helps clear it up some.