documenting the current status of affairs
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
FF:
console.log("%s %snewword", "duck")
duck newword
Chrome:
console.log("%s %snewword", "duck")
duck %snewword
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
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"}
FF:
console.table("the plaice living on the balcony")
Chrome:
console.table("the plaice living on the balcony")
FF:
console.table(new Set([{name: "terin", owner: false}, {name: "robert", owner: false}, {name: "domenic", owner: true}]))
Chrome:
console.table(new Set([{name: "terin", owner: false}, {name: "robert", owner: false}, {name: "domenic", owner: true}]))
FF:
console.table([[1, 2, 3, 4], [5, 6, 7, 8]], [2, 3])
Chrome:
console.table([[1, 2, 3, 4], [5, 6, 7, 8]], [2, 3])
FF:
console.table([[1, 2, 3, 4], [5, 6, 7, 8]], 2, 3)
Chrome:
console.table([[1, 2, 3, 4], [5, 6, 7, 8]], 2, 3)
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
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
Edge:
console.count()
undefined
: 1
Chrome:
console.count()
: 1
undefined
FF:
console.count()
<no label>: 1
undefined
<no label>
appears in FF
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
Edge:
console.count(null)
undefined
: 2
Chrome:
console.count(null)
null: 2
undefined
FF:
console.count(null)
null: 1
undefined
Edge has no label
Edge:
console.count(undefined)
: 1
undefined
Chrome:
console.count(undefined)
undefined: 1
undefined
FF:
console.count(undefined)
undefined: 1
undefined
Edge has no label
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
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/