DeleteElement (array, key)

Result type:  Boolean (0, or 1)

Definition:  Removes an element from an array (note that arrays are passed by reference). Returns true if the element was found and removed. Returns false if no element with the key was found.


let a = CreateArray();
let a["key1"] = 5
let a["key2"] = "foo"
alert(ElementExists(a, "key1")) // displays 1
DeleteElement(a, "key1")
alert(ElementExists(a, "key1")) // displays 0

Availability:  available within MWScript handlers.

See Also:

CountElements: Get the size of an associative array

CreateArray: Create an empty associative array

ElementExists: Check if a key exists in an associative array

ParamsFromArray: Expand array values to a variable parameter list