refs

Returns the reference count of a value.

The count returned is generally one higher than you might expect, because it includes the (temporary) reference.

Different nodes might return different reference values since the reference counter can be higher of lower depending on how the value is stored and used.

This function does not generate an event.

Function

refs(value)

Arguments

Argument Type Description
value any (required) The value to return the reference count for.

Return value

Reference count of the given value.

Example

Returns the reference count of a given value:

[
    refs( 'some string' ),
    refs( a = b = c = 42 ),
];

Example return value in JSON format

[
    2,
    5
]