ee.Number.getInfo

Retrieves the value of this object from the server.

If no callback function is provided, the request is made synchronously. If a callback is provided, the request is made asynchronously.

The asynchronous mode is preferred because the synchronous mode stops all other code (for example, the EE Code Editor UI) while waiting for the server. To make an asynchronous request, evaluate() is preferred over getInfo().

Returns the computed value of this object.

UsageReturns
Number.getInfo(callback)Object
ArgumentTypeDetails
this: computedobjectComputedObjectThe ComputedObject instance.
callbackFunction, optionalAn optional callback. If not supplied, the call is made synchronously.

Examples

Code Editor (JavaScript)

/**
 * WARNING: this function transfers data from Earth Engine servers to the
 * client. Doing so can negatively affect request processing and client
 * performance. Server-side options should be used whenever possible.
 * Learn more about the distinction between server and client:
 * https://developers.google.com/earth-engine/guides/client_server
 */

// A server-side ee.Number object.
var numberServer = ee.Number(10.3);

// Use evaluate to transfer server-side number to the client.
var numberClient = numberServer.getInfo();
print('Client-side primitive data type', typeof numberClient);  // number
print('Client-side number', numberClient);  // 10.3
print('Client-side number used in expression', numberClient + 10);  // 20.3