refs

Returns the reference count of a value.

Generally, the count returned is 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 or lower depending on how the value is stored and used.

This function does not generate a change.

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
]