Stew.delete() - shysolocup/stews GitHub Wiki
deletes an entry by key or index
type: Function
works the same as:
delete Stew[entry];
delete Stew.key;
alt names:
- del()
- remove()
- rem()
arguments:
- entry
Any
:
index or key to delete
list: | pair: |
const { Stew } = require('stews');
let arr = new Stew([ "a", "d", "b", "c" ]);
arr.delete(1); // deletes "d"
console.log(arr); |
const { Stew } = require('stews');
let obj = new Stew({ key1: "val1", key3: "val3", key2: "val2" });
obj.delete(1); // deletes key3
console.log(obj); |
Stew(3) [ "a", "b", "c" ] |
Stew(2) { key1: "val1", key2: "val2" } |