Skip to content

Function_evisit_core_js_utils_sizeof

Wyatt Greenway edited this page Jan 31, 2017 · 3 revisions

function sizeOf(obj)

Parameters

  • obj
    • (Object|String|Array) >>> Object, Array, or String to report size on

Return value

  • (Number) Size / length of object

Description

Return the size of an Object, Array or String. Size is ascertained in the following manner:

  1. If the object passed in has a "size" function, this will be called and the value returned will be the "size".
  2. If the object is an Array or a String, return the "length"
  3. If the object contains a "length" property, return that as the "size"
  4. If the object is an instance of Object, return the number of "keys" the plain object contains
  5. Otherwise return 0

Clone this wiki locally