I am writing a script in JavaScript & HTML and have some optimization problems. In the `for`, loop I check a variable named `visible` in every `if` clause. I think it's meaningless because once I know that the variable value is false there is no need to check the remaining if clauses but skip to the last line. I thought about `goto` but don't want to use it, and don't know how to fix it. 

```
<script>    
function filterServices(){  
    var download = document.getElementById('download').checked;
    var free = document.getElementById('free').checked;
    var pay = document.getElementById('pay').checked;
    var audio = document.getElementById('audio').checked;
    var video = document.getElementById('video').checked;
    var offline = document.getElementById('offline').checked;

    for (i = 0; i < serwisy.length; i++) {

        var serwis = serwisy[i];
        var el = document.getElementById(serwis[0]);    
        var visible = true;

        if(download && visible){    visible = serwis[2] == 1 ? true : false;}
        if(audio && visible){   visible = (serwis[3] & (1 << 1)) != 0 ? true : false;}
        if(video && visible){   visible = (serwis[3] & (1 << 2)) != 0 ? true : false;}
        if(offline && visible){ visible = (serwis[3] & (1 << 3)) != 0 ? true : false;}  
        if(free && visible){    visible = (serwis[4] & (1 << 1)) != 0 ? true : false;}
        if(pay && visible){ visible = (serwis[4] & (1 << 2)) != 0 ? true : false;}

        el.style.visibility = visible ? "visible" : "hidden";
        }
    }

```

Here's my attempt to fix it. However, it was not approved because I am allowed to use only logical operators and no reference to the HTML code.

```
<script>    
function filterServices(){  
    var download = document.getElementById('download').checked;
    var free = document.getElementById('free').checked;
    var pay = document.getElementById('pay').checked;
    var audio = document.getElementById('audio').checked;
        var video = document.getElementById('video').checked;
    var offline = document.getElementById('offline').checked;

    for (i = 0; i < serwisy.length; i++) {

        var serwis = serwisy[i];
        var el = document.getElementById(serwis[0]);            

        if(download){   
            if(serwis[2] != 1){ el.style.visibility = "hidden"; continue;}}
        if(audio){  
            if((serwis[3] & (1 << 1)) != 0){    el.style.visibility = "hidden"; continue;}}
        if(video){  
            if((serwis[3] & (1 << 2)) != 0){    el.style.visibility = "hidden"; continue;}}
        if(offline){    
            if((serwis[3] & (1 << 3)) != 0){    el.style.visibility = "hidden"; continue;}}
        if(free){   
            if((serwis[4] & (1 << 1)) != 0){    el.style.visibility = "hidden"; continue;}}
        if(pay){    
            if((serwis[4] & (1 << 2)) != 0){    el.style.visibility = "hidden"; continue;}}

        el.style.visibility = "visible" : "hidden";
        }
    }

```

Does anyone have any idea how to improve this code?