Question about question mark in JavaScript

Discussion in 'Javascript' started by Jimolo, Jan 20, 2008.

  1. Jimolo

    Jimolo Guest

    Hi

    What does a questionmark before a variable do?

    For instance,

    var test1 = ''

    var test2 = '?test1'

    What does it do?
    Jimolo, Jan 20, 2008
    #1
    1. Advertising

  2. Richard Hijdra wrote:
    > Jimolo wrote:
    >
    >> Hi
    >>
    >> What does a questionmark before a variable do?
    >>
    >> For instance,
    >>
    >> var test1 = ''
    >>
    >> var test2 = '?test1'
    >>
    >> What does it do?

    >
    > In what context do you mean this?
    > Normally I would say its a query after an URL like;
    >

    three meanings in my 'bible'

    the one you stated..URL stuff.

    Then teh normal C style compact condtional as in

    a=(b==c)?d:e;

    (if b equals c, set a to d, else set a to e)

    Or a part of a regexp pattern matching string thing.



    > instance 1
    > http://www.domain.ext/page.htm
    >
    > instance 2
    > http://www.domain.ext/page.htm?test1
    >
    > Where in 2nd instance there will be a query carried out on the page
    > (this can for instance been used to pass a variable to the page)
    >
    > Works like this
    > http://www.rhi.nl/contact/bedankttr.htm?trouwdd=Maandag 01-02-2003&naam=Richard
    >
    >
    > Greetz,
    > Richard
    >
    The Natural Philosopher, Jan 20, 2008
    #2
    1. Advertising

  3. Jimolo meinte:
    > Hi
    >
    > What does a questionmark before a variable do?
    >
    > For instance,
    >
    > var test1 = ''
    >
    > var test2 = '?test1'
    >
    > What does it do?


    Here? test2 contains the string "?test1". There is no "question mark
    before a variable".

    Gregor


    --
    http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
    http://web.gregorkofler.com ::: meine JS-Spielwiese
    http://www.image2d.com ::: Bildagentur für den alpinen Raum
    Gregor Kofler, Jan 20, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cirene
    Replies:
    5
    Views:
    571
    Cirene
    May 17, 2008
  2. David Mark

    David Mark's Javascript Tip of the Day

    David Mark, Nov 5, 2011, in forum: Javascript
    Replies:
    5
    Views:
    782
    David Mark
    Nov 7, 2011
  3. David Mark

    David Mark's Javascript Tip of the Day

    David Mark, Nov 7, 2011, in forum: Javascript
    Replies:
    4
    Views:
    789
    David Mark
    Nov 8, 2011
  4. David Mark
    Replies:
    16
    Views:
    891
    Scott Sauyet
    Nov 11, 2011
  5. David Mark
    Replies:
    58
    Views:
    1,382
    David Mark
    Dec 6, 2011
Loading...

Share This Page