I am creating a user based function that I will save in my repository for re-use later. But I'm facing a problem with putting default values in my parameters.
var myFunction = function(number, power = 2){
return(ee.Number(a).pow(power);
}
print(myFunction(2);
print(myFunction(2,3);
The whole point is that most of the time I will want to square a number, but some time I may want to do another power. When you run the above example, you get an unexpected token error. Which is surely due to the "=" in the function definition.
How can I set default parameters?