let obj = {id: 123}, s; try{ s = 'keeeek' + obj[id]; alert(s); } catch(e){ alert(e); } try{ s = 'blablabla' + obj['id']; alert(s); } catch(e){ alert(e); }