[Webkit-unassigned] [Bug 82468] New: Deleting an array item causes it to appear as `undefined x 1` in the console

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 28 08:13:00 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=82468

           Summary: Deleting an array item causes it to appear as
                    `undefined x 1` in the console
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
               URL: data:text/html,<script>var%20array%20%3D%20%5B0%2C%201
                    %2C%202%2C%203%5D%3B%20delete%20array%5B0%5D%3B%20cons
                    ole.log(array)%3B<%2Fscript>
        OS/Version: Unspecified
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: Web Inspector
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: mathias at qiwi.be


Open the console and enter:

    var array = [0, 1, 2, 3]; delete array[0]; array;

This will log the following to the console:

    [undefined × 1, 1, 2, 3]

However, this:

    [undefined, 1, 2, 3];

…will log:

    [undefined, 1, 2, 3]

What’s with the `undefined × 1` thing? Why the different output for these two scenarios? Similarly, the following:

    var array = [0, 1, 2, 3]; delete array[0]; delete array[1]; array;

…logs:

    [undefined × 2, 2, 3]

Which makes more sense, as this saves space compared to logging:

    [undefined, undefined, 2, 3]

Is this documented anywhere?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list