ports = [80, 443, ...]
if port in ports and http:
...
Or with underscore: var ports = [80, 443, ...];
if(_(ports).contains(port) && http) {
...
}
Good collections make it better than manually checking the return code or checking an explicit set of port values. Also configuration > magic_nums. if( [80, 443].indexOf(port) !== -1 && http === false )
Because worse is better. https://www.jwz.org/doc/worse-is-better.html