Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-105

Javascript cycle "for (index in array)" is used for arrays - replace with normal "for (index = 0; i < array.length; i++)"

    XMLWordPrintable

    Details

    • Type: Bug Report
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.3.9
    • Fix Version/s: 5.0.0
    • Component/s: Optimization
    • Labels:
      None

      Description

      Currently in some places arrays are accessed as objects in cycles:
      var arr = ['one', 'two'];
      for (var elem in arr)

      { alert( arr[elem] ); }

      This approach works until someone adds new methods to Array class declaration. I propose to change such approach to normal "for" cycle:
      var arr = ['one', 'two'];
      for (var elem = 0; i < arr.length; elem++) { alert( arr[elem] ); }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                alex Alex
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: