Please, change to

```javascript
var val = fieldValue ? fieldValue.value : fieldValue;
```

It is clearer.