There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.
Close

Processing...
This may take a few seconds.

var-delete

Syntax

var-delete: (name) [every (time)] [after (time)][, (name)...];

name = The name of the variable to delete. If you delete a variable, you remove it so it is no longer there.

If the variable was declared with the session-storage or local-storage options, then it will be removed from those areas too.

The var-delete action command works with whole variables, individual array items or object properties.

Example, to delete a variable (note - no curly brackets needed on the main variable):

div:click {
var-delete: $myVariable;
}

Example, to delete the item at index 0 in an array called myArray:

var-delete: $myArray[0];

Example, to delete an object property in an object called myObject:

var-delete: $myObject.dave;

Example, to delete an object property specified by a value in the variable "name" in an object called myObject (note - no curly brackets needed):

var-delete: $myObject[name];

Technical note: Behind the scenes, this utilises the power of lodash unset.