Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. What is type of foo, if foo != foo?

What is type of foo, if foo != foo?

Scheduled Pinned Locked Moved The Lounge
question
24 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Palash Mondal_

    Recently had been debugging using the browser console, when I found this answer. Can you guess the type of foo here? Is it a string, function or else?

    P Offline
    P Offline
    PIEBALDconsult
    wrote on last edited by
    #21

    How about int ?

    private static System.Random randy = new System.Random() ;
    int foo { get { return ( randy.Next() ) ; } }

    :-D

    D 1 Reply Last reply
    0
    • P PIEBALDconsult

      How about int ?

      private static System.Random randy = new System.Random() ;
      int foo { get { return ( randy.Next() ) ; } }

      :-D

      D Offline
      D Offline
      Dennis_E
      wrote on last edited by
      #22

      Or DateTime:

      DateTime foo { get { return DateTime.Now; } }

      :-D

      1 Reply Last reply
      0
      • N newton saber

        spoiler alert -- answer is below Opened Chrome Dev console and ran the following.

        var x = 'garbage' / 10;

        x
        NaN

        x != x // with coercion
        true

        x !== x // even without coercion
        true

        typeof(x)
        "number"

        P Offline
        P Offline
        Palash Mondal_
        wrote on last edited by
        #23

        Awesome :thumbsup:

        1 Reply Last reply
        0
        • P Palash Mondal_

          Recently had been debugging using the browser console, when I found this answer. Can you guess the type of foo here? Is it a string, function or else?

          U Offline
          U Offline
          User 11783308
          wrote on last edited by
          #24

          NaN

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups