# preferenceForKey()

Description:

The `preferenceForKey` method allows a previously stored preference to be restored.

Syntax:

    [string] window.widget.preferenceForKey(String key)

or

    [string] widget.preferenceForKey(String key)

Arguments:

- `key`:

  A text string specifying the name that represents the preference to be restored.

Return value:

A text string contains the preference value associated with the specified key.

If the key does not exist, the return value is "undefined".

Example code:

    // Check for the existence of searchKey
    if(widget.preferenceForKey('searchKey'))
    {
     // get the searchKey from the preference
     var searchArg = widget.preferenceForKey('searchKey');
     // set the search argument to the search field
     document.forms[0].searchKey.value = searchArg;
    }