Skip to content

Latest commit

 

History

History
415 lines (279 loc) · 5.91 KB

NOTES.md

File metadata and controls

415 lines (279 loc) · 5.91 KB

Found differences

documenting the current status of affairs

integer formatter

FF:

console.log("%d", null)
0

Chrome:

console.log("%d", null)
NaN

FF:

console.log('bjoern and robert are born on the %dst dec', "foo")
bjoern and robert are born on the 0st dec

Chrome:

console.log('bjoern and robert are born on the %dst dec', "foo")
bjoern and robert are born on the NaNst dec

not enough arguments to interpolate all placeholders

FF:

console.log("%s %snewword", "duck")
duck newword

Chrome:

console.log("%s %snewword", "duck")
duck %snewword

console.assert - string formatter

FF / Edge:

console.assert(false, "robert keeps %s on his balcony", "plaices")
robert keeps plaices on his balcony

Chrome:

console.assert(false, "robert keeps %s on his balcony", "plaices")
Assertion failed: robert keeps %s on his balcony plaices

console.assert

FF / Edge:

console.assert(false, "robert keeps %s on his balcony", {foo: "bar"})
robert keeps [object Object] on his balcony

Chrome:

console.assert(false, "robert keeps %s on his balcony", {foo: "bar"})
Assertion failed: robert keeps %s on his balcony Object {foo: "bar"}

console.table - printing of strings

FF:

console.table("the plaice living on the balcony")

Image of Firefox printing console.table():

Chrome:

console.table("the plaice living on the balcony")

Image of Chrome printing the string

console.table - Sets

FF:

console.table(new Set([{name: "terin", owner: false}, {name: "robert", owner: false}, {name: "domenic", owner: true}]))

Image of Firefox displaying the Set as a table

Chrome:

console.table(new Set([{name: "terin", owner: false}, {name: "robert", owner: false}, {name: "domenic", owner: true}]))

Image of Chrome not printing the Set as a table

console.table - Indexes

FF:

console.table([[1, 2, 3, 4], [5, 6, 7, 8]], [2, 3])

Image of Firefox not displaying the table with custom indexes

Chrome:

console.table([[1, 2, 3, 4], [5, 6, 7, 8]], [2, 3])

Image of Chrome not displaying the table with custom indexes

console.table - Multiple Arguments

FF:

console.table([[1, 2, 3, 4], [5, 6, 7, 8]], 2, 3)

Image of Firefox not displaying the table with additional arguments

Chrome:

console.table([[1, 2, 3, 4], [5, 6, 7, 8]], 2, 3)

Image of Chrome not displaying the table with additional arguments

console.count - counters and label repetition

Edge:

console.count('foo')
undefined
foo:           2
console.count('foo')
undefined

FF / Chrome:

console.count('foo')
foo: 1
undefined
console.count('foo')
foo: 2
undefined

Edge: the counter is raised where the first label foo is printed
FF/Chrome: the label is printed multiple times with the current counter

console.count - objects / arrays

Edge:

console.count({})
undefined
[object Object]: 1

console.count([])
undefined
:           1

Chrome:

console.count({})
[object Object]: 1
undefined

console.count([])
: 1
undefined

FF:

console.count({})
[object Object]: 1
undefined

console.count([])
<no label>: 1
undefined

<no label> appears in FF

console.count - no arguments

Edge:

console.count()
undefined
: 1

Chrome:

console.count()
: 1
undefined

FF:

console.count()
<no label>: 1
undefined

<no label> appears in FF

- no arguments / empty strings

Edge:

console.count()
: 1
undefined

console.count("")
: 1
undefined

Chrome:

console.count()
: 1
undefined

console.count("")
: 2
undefined

FF:

console.count()
<no label>: 1
undefined
console.count("")
<no label>: 2
undefined

Chrome/FF count no-arguments and empty-string as the same counter, FF adds <no label>.
Edge counts empty-string and no-arguments separetely

console.count - null

Edge:

console.count(null)
undefined
: 2

Chrome:

console.count(null)
null: 2
undefined

FF:

console.count(null)
null: 1
undefined

Edge has no label

console.count - undefined

Edge:

console.count(undefined)
: 1
undefined

Chrome:

console.count(undefined)
undefined: 1
undefined

FF:

console.count(undefined)
undefined: 1
undefined

Edge has no label

console.time - no param/undefined

FF:

console.time() // no timer started
console.time(undefined) // no timer started

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1270636

Chrome:

console.time()
console.time(undefined)

console.timeEnd()
default: <time in ms here>
console.timeEnd()
undefined: <time in ms here>

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=696798

console.time - label conversion / conversion errors

FF:

console.time({ toString() {throw new Error("Farolino")} }) // toString called, no error thrown, no timer started

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1343013

Chrome:

console.time({ toString() { return 'conversion' } }) // timer started with label `[object Object]`

console.timeEnd('conversion')
console.timeEnd({})
[object Object]: <time in ms here>

// ...

console.time({ toString() { throw new Error("Farolino") } }) // toString never called, no timer started

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=696805

Edge:

console.time({ toString() { throw new Error("Farolino") } }) // toString called, no error thrown, no timer started

Bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11201116/