What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] 'undefined' is null or not an object.

[Help] 'undefined' is null or not an object.
Author: Message:
Jesus
Scripting Contest Winner
****

Avatar
Koffie, my cat ;)

Posts: 623
Reputation: 15
38 / Male / Flag
Joined: Jul 2005
RE: [Help] 'undefined' is null or not an object.
quote:
Originally posted by pollolibredegrasa
Array.length gives the number of items +1
it does not. (well, in some specific cases it does, but not in this case)

quote:
Originally posted by windows scripting documentation
As the elements in an array do not have to be contiguous, the length property is not necessarily the number of elements in the array. For example, in the following array definition, my_array.length contains 7, not 2:
code:
var my_array = new Array( );
my_array[0] = "Test";
my_array[6] = "Another Test";



Because Timma's textray is made by using string.split(), it is a contiguous array. In this case textray.length gives you the exact number of elements in the array textray.
The reason textray[textray.length] does not exist, is because the elements counter is zero-based, whereas textray.length is not.
example:
If you have a string of only one word as input, string.split(" ") will return an array (textray) with only 1 element.
this element is stored in textray[0], but textray.length will be 1.
Man is least himself when he is in his own person. Give him a mask and he will tell you the truth. (Oscar Wilde)
09-15-2008 11:20 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Help] 'undefined' is null or not an object. - by Timma on 09-14-2008 at 04:22 AM
RE: [Help] 'undefined' is null or not an object. - by Matti on 09-14-2008 at 01:30 PM
RE: [Help] 'undefined' is null or not an object. - by Timma on 09-15-2008 at 09:31 AM
RE: [Help] 'undefined' is null or not an object. - by pollolibredegrasa on 09-15-2008 at 10:34 AM
RE: [Help] 'undefined' is null or not an object. - by Jesus on 09-15-2008 at 11:20 AM
RE: [Help] 'undefined' is null or not an object. - by Timma on 09-16-2008 at 05:51 AM
RE: [Help] 'undefined' is null or not an object. - by Jesus on 09-16-2008 at 09:34 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On