Closed Bug 1492558 Opened 6 years ago Closed 6 years ago

console.table not working properly

Categories

(DevTools :: Console, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1326182

People

(Reporter: savvysiddharth, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0
Build ID: 20180712150008

Steps to reproduce:

class Box //has array of items
{
	constructor(totalItems)
	{
		this.data = [];
		for(let i=0;i<totalItems;i++)
			this.data[i] = 0;
	}

	add(n) //adds to each element of array
	{
		for(let i=0;i<this.data.length;i++)
			this.data[i] += n;
	}
}

let mybox = new Box(5);

console.log(mybox.data);
console.table(mybox.data);

mybox.add(2);

console.log(mybox.data);
console.table(mybox.data);


Actual results:

at first console.log it printed correct values for array (ie. all zeroes)
but for first console.table it printed all 2's, which is should be only after function add is executed
the latter console.log and console.table printed as expected


Expected results:

first console.table should have printed zero for all
as in screenshot attached
expected (LEFT SIDE) and actual result (RIGHT SIDE)
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Component: JavaScript Engine → Console
Product: Core → DevTools
Version: 61 Branch → unspecified
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: