You could drop the inner parens:

```javascript
port = urlParts.port || (urlParts.protocol === 'http:' ? 80 : 443);
```