This is OK but it could be a bit more compact, e.g.:
```javascript
        nameEntered = nameEntered.replace(/^\s+|\s+$/g, '');
        if (nameEntered === myName || bluetooth.enabled || !defaultAdapter) {
          return;
        }
        var req = defaultAdapter.setName(nameEntered || productModel);
        req.onsuccess = function bt_renameSuccess() {
          myName = visibleName.textContent = defaultAdapter.name;
        };
```