Would this also work?

```javascript
if (spec.defaultValue !== undefined)
```