pop(id)

Pops a data from the last index of an array data in a node.

Parameters

  • id (string) - string id of a node. The node must contain data type of array.

Returns

  • (anything) - data at last index of the array.

Examples

import Treeful from 'treeful';

Treeful.add('n1', [ 'item1', 'item2' ]);

let popped = Treeful.pop('n1'); 
// popped == 'item1'
// Treeful.get('n1') == [ 'item2' ]

results matching ""

    No results matching ""