[links-list] Re: javascript parse question.

Dave Mielke dave at mielke.cc
Thu Jun 6 13:20:19 PDT 2002


[quoted lines by Zhao, Jing on June 6, 2002, at 14:58]

>  'trim' function is as followed:

I never did learn JavaScript very well, but here are a few observations:

>    var len =   value.length;
>
>    index   =   0;

Which is the correct syntax? Both of these lines appear to be defining a local
variable, but one says "var" and one doesn't. Perhaps some browsers support
both forms but links only supports one of them.

>    for(i=0;i<len;i++)
>    {
>        if(value.charAt(i)  !=  " ")
>        {
>            i   =   len;

Why not use "break" here? My guess is that JavaScript has such a statement.

>    for(i=len-1;i>=0;i--)
>    {
>        if(value.charAt(i)  !=  " ")
>        {
>            i   =   -1;

Again, why not use "break" here?

-- 
Dave Mielke           | 2213 Fox Crescent | I believe that the Bible is the
Phone: 1-613-726-0014 | Ottawa, Ontario   | Word of God. Please contact me
EMail: dave at mielke.cc | Canada  K2A 1H7   | if you're concerned about Hell.
http://familyradio.com

-- 
Unsubscribe: send email to links-list-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message



More information about the links-list mailing list