redho home | products | services
Web Design Forums

Web Design Forums  


Web Hosting, Web Design, Software and Web Development Forums  
 FAQFAQ   MemberlistArchive  Log inLog in   RegisterRegister 
         

the array is still empty



 
Post new topic   Reply to topic    Web Design Forums -> JavaScript forum
View previous topic :: View next topic  
Author Message
froomzer



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



Joined: 31 May 2006
Posts: 142
Anything defined outside of the functions is global
Anything non-local
  Reply with quote
Peter Pitt



Joined: 20 May 2006
Posts: 114
Location: Egypt
As is anything without the var keyword
  Reply with quote
BigDaddy



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



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



Joined: 30 May 2006
Posts: 101
Of course
  Reply with quote
froomzer



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



Joined: 24 May 2006
Posts: 97
Use \n
Or <br> if it's html
  Reply with quote
froomzer



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



Joined: 26 May 2006
Posts: 147
\
"bleh\
Moo";
  Reply with quote
froomzer



Joined: 23 May 2006
Posts: 148
BigDaddy, ah, yeah, didn't think to try that. Thanks.
  Reply with quote


froomzer



Joined: 23 May 2006
Posts: 148
Mupolan, I can confirm it's working for me.
  Reply with quote
Page 1 of 1
Post new topic   Reply to topic    Web Design Forums -> JavaScript forum


Dubai Forums - Expat Help | Vegan Chat | Java Programming | Free 3D tutorials and 3d textures | Paris Forum | EU Forum
Free Dubai Classifieds | Free London Classifieds | Jobs in London

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

Powered by phpBB © 2001, 2005 phpBB Group