My assignment is to find all <p> and hide the ones that are <p class="show"> using a For Loop. "show" is supposed to be hidden when loading the page, because im gonna do a < a > that is gonna show them. This is what i have done, and it doesnt work. Did i do something wrong or am i way off here ?

windows.onload = prepareShow;
function prepareShow(){
var fan = document.getElementsByClassName("show");
for (var i = 0; i < fan.length; i++){
if (fan[i].getAttribute("class")=="show"){