Function length

Returns the length of a string or an array.

length('abc'); // 3
length([1, 2, 3]); // 3
  • Parameters

    • source: string | readonly unknown[]

      The string or array.

    Returns number

    The length of the string or array.