Open WolfWalter opened 1 year ago
+1
myReturnObject = {}
stringFromPreviousResult = "52.525243"
myReturnObject.property = Number(stringFromPreviousResult)
What is the proper way to convert a string to a number with APPSYNC_JS runtime?
As a workaround I used the unary operator: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Unary_plus
const test = '123';
const testNumber = +test;
I tried to convert my object keys from string to numbers, but got "The code contains one or more errors. " as a response when I tried to use
parseInt
,parseFloat
orNumber()
.