views:

20

answers:

2

I am experencing a very odd javascript error that I can't figure out how to get rid of. The following code throws an exception saying "'options' is not defined" on line 29. As you can see, the object is defined (or should be...), and it is being used without exceptions on the line right before, in the middle of an array initializer.

The output from the console.log() call on line 24 is shown below the code. I have cleared the chache to make sure the browser is not running an old version of the file. This is visible in both Chrome and Firefox/Firebug consoles.

Can anyone explain this?

10 var options = $.extend({
11 windowName: 'NCVIB',
12 width: 1010,
13 height: 660,
14 toolbar: false,
15 location: false,
16 directories: false,
17 status: true,
18 menubar: false,
19 scrollbars: true,
20 resizable: true,
21 copyhistory: false
22 }, popupOptions);
23
24 console.log(options);
25
26 var features = [
27 'width=', options.width,
28 ',height=', options.height,
29 ',toolbar=', opitons.toolbar,
30 ',location=', opitons.location,
31 ',directories=', options.directories,
32 ',status=', opitons.status,
33 ',menubar=', options.menubar,
34 ',scrollbars=', options.scrollbars,
35 ',resizable=', options.resizable,
36 ',copyhistory=', options.copyHistory
37 ]; 

Console output:

Object { windowName="NCVIB", more...}

Expanding the object by clicking it yields a list of all properties. All the above properties are in the list, and none are set to undefined.

+5  A: 

opitons != options :)

Pekka
+1 fast fingers
gnarf
Are you sure about this? I mean it has all the same letters and everything :)
Nick Craver
Yes, teh cmopiler sohudl eb albe ot hadnel aangarsm, irgth?
Guffa
@Affug eahy! --
Pekka
Sigh... so easy. But I've been staring myself blind at this for too long now... Thanks a lot! =)
Tomas Lycken
+3  A: 

Could it be the typo on lines 29 & 32 -- opitons

gnarf