πŸ“Š Function: count

Counts the number of items in a list, object, array, or string input.

This is NOT a mathematical sum - it simply counts how many items are in the input you feed it.

βš™οΈ Usage

Array:

Pass an array and it counts the elements.

String:

Specify a separator (comma by default) to split and count items. If no separator is specified for strings, it auto-detects commas or spaces.

Object:

Counts the number of keys.

πŸ’» Examples

["a", "b", "c"]
β†’3
"apple,banana,orange"separator: ","
β†’3
"apple banana orange"separator: " "
β†’3
{name: "John", age: 30}
β†’2
"hello"
β†’1
""
β†’0

Note:

πŸ“‹ Parameters

NameTypeDescriptionDefault
inputArrayStringObjectThe list, array, or string to count[]
separatorStringDelimiter for splitting strings (optional)","

↩️ Returns

NumberThe total count of items in the input.
Open in editor
Built in Nordcraft The website builder for creative studios