How to display an alert if none of the case statements match?
<p>I have a case statement below where it checks for a file type in a file input which works correctly:</p>

<pre><code>function imageValidation(imageuploadform) {
    var val = $(imageuploadform).find(".fileImage").val();
    switch(val.substring(val.lastIndexOf('.') + 1).toLowerCase()){
        case 'gif':
        case 'jpg': 
        case 'jpeg':
        case 'pjpeg':
        case 'png':
             return true;
        default:
            $(imageuploadform).find(".fileImage").val();
            // error message here
            alert("To upload an image, please select an Image File");
            return false;
    }
    return false;
}
</code></pre>

<p>Now what happens is that if it matches one of the case statements then it returns true and by default it returns an alert which I want to use if file input is blank.</p>

<p>But how can I display this alert: </p>

<pre><code>alert("Image File Type is Incorrect. Must be either: \n (jpg, jpeg, pjpeg, gif)")
</code></pre>

<p>If the file input does not match with one of the file type cases above?</p>
