Can be shortened to `id = (typeof popupsInfo.id !== 'undefined' ? popupsInfo.id : 'popup') + '_' + feature.id;`
The rest of the declarations below shouldn't need the braces around the `typeof` statements