Web Analytics Made Easy -
StatCounter Help with "returned" value - CodingForum

Announcement

Collapse
No announcement yet.

Help with "returned" value

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with "returned" value

    Hi, another question that goes beyond my knowledge of JavaScript - I appreciate any help - even a brief explanation so I can start to wrap my head around it.

    What is returned when the following code executes?
    var number = 10;
    var highest = 18;
    return ( number > highest ) ? highest : number;

  • #2
    return ( number > highest ) ? highest : number;

    equates to

    if (condition) ? (return highest if (true)) : (return number if (false))

    Comment


    • #3
      Ah, so it is returning one of the two values based on a comparison then. I might be catching on now. Thank you!

      Comment

      Working...
      X