How to check if an input is undefined

So i have a function, lets say:

function a(string).....

and i want to check if the string is undefind. if it is do something
The code would look something like this:

function a(string){
 if(string == null){
 //do something
 }
 else{
 //do another thing
 }

The problem is it doesn’t seem to work, even if the string isn’t declared its still going to call the else. Maybe we could try doing

 if(string == "undefind"){
 //do something
 }
 else{
 //do something else
 }

but yet it doesn’t seem to change anything. null and undefind seem to work in the same way. Is there a specific function from a library that allows the checking if an input is declared? is there a way you could check it directly from the input with something like

if(string.isDeclared()==true){
//do something
}
else{
//do something else
}