1

On Google Earth Engine, suppose I have a Number on the server side. How can I get it as an integer on the client side?

var x = ee.Number(42)
typeof(x)  //  yields "object", i.e. server side

var y = ??? // what function of x will get me a local 42 in y? 
mspices
  • 335
  • 2
  • 11

1 Answers1

1

This seems to work, although it is not recommended by the documentation:

var x = ee.Number(42)  // server side variable

var z = x.getInfo()  // local string

var y = parseInt(z)
mspices
  • 335
  • 2
  • 11