javascript question

Results 1 to 2 of 2

Thread: javascript question

  1. #1
    Join Date
    Dec 1969

    Default javascript question

    I am looking at code developed by another developed and notice that they have the following function which checks if url passed is an intranet site i.e contains xxx, yyy. How does the <BR>stringtest.test work ...what is the ".test" in <BR>stringtest.test(checkme)<BR>? is it a property?..not sure..thanks for any help.<BR><BR>function checkstring(checkme){<BR>var stringtest=/;<BR>var stringtest2=/;<BR> <BR>if(stringtest.test(checkme) &#124&#124 stringtest2.test(checkme)) {<BR> //it was an Intranet site<BR> return true;<BR>}else{<BR> return false;<BR>}<BR>}

  2. #2
    Join Date
    Dec 1969

    Default It's just pattern matching

    Basically, it is saying that if the string "" is found ANYPLACE in the checkme value, then the test passes. *OR* if the string "" is found anyplace in the checkme value, the test passes.<BR><BR>That&#039;s all.<BR><BR>No, .test is not a property. It&#039;s a *METHOD* on a JS regular expression object.<BR><BR>Go read the JS docs. (Click on "JScript Reference" in the left panel of most pages on this site.)<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts