Nest

Updated: 11/13/2018 by Computer Hope

A nest may refer to any of the following:

Golden egg in a nest.

1. Nesting is the placement of one or more objects within another object. For example, when referring to a computer, nesting may refer to inserting a graphic image into a word processor.

2. With computer programming, a nested function is a function contained inside of another function in the source code of a program. An example of this in JavaScript is shown below.

function outerFunction() {
function innerFunction() {
// code
}
}

Often, this type of nesting is used to limit the scope of the inner function.

Note

The inner function can only be called by the function containing it or another function in the containing function.

In the example above, outerFunction() could call innerFunction(), but innerFunction() could not be called from the global scope or from any function outside of outerFunction().

Nesting isolates the code it contains from code scoped outside the nested section.

With HTML (hypertext markup language), XML (extensible markup language), and other markup languages nesting is the data between the opening and closing tags. For example, with the XML code shown below "computersoftware" is the root tag which contains all other XML information. The "product" tag nests all of the product information, and "name," "description," "developer," and "cost" all nest information relating to each tag.

<computersoftware>
<product>
<name>Windows 8</name>
<description>Microsoft Windows 8 operating system - Full version.</description>
<developer>Microsoft</developer>
<cost>132.78</cost>
</product>
</computersoftware>

3. The term Nest may also refer to the Nest Learning Thermostat.

Object, Programming terms