Passing from function turning visibility true if != null

What is the best way to write this.


function myFunction(path, path2, path3, path4) {
     
      if (path != null) {
           f1._visible = true;
  ////then also turning on visibility on f2 for path 2, f3 for path3 ect.... only if they exist.
     like  if (path2 != null) {  ///was also not null then
           f2._visible = true;   ////and so on only if they are present.

   
}


I have tried to write this many ways however nothing to avail. Can someone assist on this or point to some reading for crazy ifs