Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-10916

Iterating over string using for..in produces some methods

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.4.6
    • Component/s: JavaScript
    • Labels:
      None
    • Environment:
      Ubuntu 13.04 x86_64
    • Fully Compatible
    • Linux
    • Hide

      > str = "Mongo"
      Mongo
      > for (var c in str)

      { print(c) }

      Expected result:
      0
      1
      2
      3
      4

      Actual result:
      0
      1
      2
      3
      4
      ltrim
      rtrim
      startsWith
      endsWith
      pad


      I also tested it with the native V8 version 3.21.4 or with JavaScript in Chrome. It's working well there.

      Show
      > str = "Mongo" Mongo > for (var c in str) { print(c) } Expected result: 0 1 2 3 4 Actual result: 0 1 2 3 4 ltrim rtrim startsWith endsWith pad — I also tested it with the native V8 version 3.21.4 or with JavaScript in Chrome. It's working well there.
    • Platforms 13 (04/22/16), Platforms 14 (05/13/16)

          Assignee:
          mira.carey@mongodb.com Mira Carey
          Reporter:
          mirao Jaromir Obr
          Votes:
          0 Vote for this issue
          Watchers:
          7 Start watching this issue

            Created:
            Updated:
            Resolved: