Closed Bug 1078652 Opened 10 years ago Closed 10 years ago

Use console.log(array) before array.push() displays the value post-push

Categories

(DevTools :: Console, defect)

32 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 754861

People

(Reporter: chengbao, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0
Build ID: 20140923175406

Steps to reproduce:

This is a simple js code:
<script>
    var array = [1, 2, 3];
    console.log(array);
    array.push(4);
</script>
open developer tool -> console,
run page contains above js code.

Looks like it only affect console.log(), other javascript that access array before .push() doesn't be affected. 

Although it is only affect developers, it is very frustrating when I tried to debug my code, and I kept looking at wrong places because of this bug.


Actual results:

It display 
"Array [ 1, 2, 3, 4 ]"
in console


Expected results:

Array [ 1, 2, 3 ]
This has nothing to do with the JS engine.  console.log() lazily converts its first argument to a string is all.
Component: JavaScript Engine → Developer Tools: Console
Product: Core → Firefox
Whiteboard: DUPEME
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Whiteboard: DUPEME
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.