Script Preparation code:
x
 
var noarr = 5555
var array = [1,2,3,4,5]
var array2 = [[1,2],[3,4],[5,6]]
Tests:
  • Array.flat

     
    const f1 = [noarr].flat(1)
    const f2 = [array].flat(1)
    const f3 = [array2].flat(1)
  • isArray check

     
    const n1 = Array.isArray(noarr) ? noarr : [noarr]
    const n2 = Array.isArray(array) ? array : [array]
    const n3 = Array.isArray(array2) ? array2 : [array2]
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Array.flat
    isArray check

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Chrome 114 on Windows
View result in a separate tab
Test name Executions per second
Array.flat 76484.1 Ops/sec
isArray check 230601.9 Ops/sec