| View previous topic :: View next topic |
| Author |
Message |
froomzer Enthusiastic Coder
Joined: 23 May 2006 Posts: 148
|
I defined an empty array in my .js, inside of a function I stick some things in there, call the function, and the array is still empty. Is there some bizarre scoping going on here? I didn't think js had a 'global' statement.
Reply with quote
|
| |
|
|
AmeliaR Enthusiastic Coder
Joined: 31 May 2006 Posts: 142
|
Anything defined outside of the functions is global
Anything non-local
Reply with quote
|
| |
|
|
Peter Pitt Enthusiastic Coder
Joined: 20 May 2006 Posts: 114 Location: Egypt
| |
BigDaddy Enthusiastic Coder
Joined: 26 May 2006 Posts: 147
|
Heh
Globals should be defined in global scope, not by omitting the var keyword.
Declared*
Reply with quote
|
| |
|
|
froomzer Enthusiastic Coder
Joined: 23 May 2006 Posts: 148
|
That was my understanding, too. But I've got the function logging as it sticks things in and the next line of code tries to pull something out and gets nothing.
Well, having confirmed there isn't something bizarre happening with scoping, I'm thinking it's a problem with array identifiers and will go away as I whittle this down to a minimal example.
Argh, yeah. The identifier I was sticking into the array with was undefined due to typo. Thanks, folks.
Is it possible to have a multi-line string?
Reply with quote
|
| |
|
|
Mupolan Enthusiastic Coder
Joined: 30 May 2006 Posts: 101
| |
froomzer Enthusiastic Coder
Joined: 23 May 2006 Posts: 148
|
I'm getting "unterminated string literal" errors.
I put the string back on one line, it goes away.
Reply with quote
|
| |
|
|
Jackil Enthusiastic Coder
Joined: 24 May 2006 Posts: 97
| |
froomzer Enthusiastic Coder
Joined: 23 May 2006 Posts: 148
|
I want the string to span multiple lines of source code so I can read it, I'm not trying to whitespace output.
Reply with quote
|
| |
|
|
BigDaddy Enthusiastic Coder
Joined: 26 May 2006 Posts: 147
| |
| Page 1 of 2 |
Goto page 1, 2 Next |
|