1 var myEle = document.getElementById("myElement");
2 if(myEle){
3 var myEleValue= myEle.value;
4 }
5
6//the return of getElementById is null if an element is not actually
7//present inside the dom, so your if statement will fail, because null
8//is considered a false value