if isset statement with javascript?

Alyonah74

New Member
?n php I would use this to see if a variable is set and then use that value, otherwise make it a zero:\[code\] $pic_action = isset($_POST['pic_action']) ? $_POST['pic_action'] : 0;\[/code\]But what is the equivalent in javascript?I want to check if an element exists in the document, and then if it does, add it to the variable, otherwise add some other value to it, here is what I have so far:\[code\] var areaOption = document.getElementById("element");\[/code\]Thanks
 
Back
Top