[nfbcs] Javascript question:

Aaron Cannon cannona at fireantproductions.com
Mon Sep 10 01:08:29 UTC 2018


indexOf will return -1 if it doesn't find the string that was passed to it in the string it was called on. So, if n is always empty, indexOf a non-empty string will never find that string, so it will always return -1. As a result, the first condition of that if statement will never be true, therefore the if statement will never run.

Aaron

--
This message was sent from a mobile device


> On Sep 9, 2018, at 08:46, Charles E. Black via nfbcs <nfbcs at nfbnet.org> wrote:
> 
> Morning:
> 
> question relates to javescript:
> if p is a declaired variable with no value and n is an empty string, then
> what will the following if statement resolve to:
> if((p=n.indexOf("?"))>0&&parent.frames.length)
> 
> 
> _______________________________________________
> nfbcs mailing list
> nfbcs at nfbnet.org
> http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
> To unsubscribe, change your list options or get your account info for nfbcs:
> http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/cannona%40fireantproductions.com




More information about the NFBCS mailing list