I get a strange error in Chrome ... check the screenshot below.
I define a record using the object literal syntax.
I am trying to set the id property and get an exception.
I tried both:
record['id'] = 'wtf';
and
record.id = 'wtf';
I use this type of syntax throughout my script .... what can happen here? Is this a bug in Chrome?
EDIT: At the moment, I have solved the problem, but I'm still not sure why this is happening. I moved the definition of write to write outside the if block. Does anyone know what could happen? I thought that all variable declarations are bound to a function, and therefore this should not be a problem.
, dl , , record, . , , , if, , record['id'] = 'wtf'; , .
dl
record
if
if, if (, , , ).
, - :
if (dl > 0) { var record = {}; record.id = 'wtf'; }
record .
, , , . record , - undefined, .
undefined
, , . , ? , alert(record), ? ?
alert(record)