I program JavaScript when using Parse CloudCode. In my case, I use CloudCode to call the Stripe API.
For example:
Objective-C
NSDictionary *parameters = @{
@"customerId": stripeCustomerId,
@"amount": @(100),
};
[PFCloud callFunctionInBackground:@"chargeCustomer" withParameters:parameters block:block];
JavaScript
Parse.Cloud.define("chargeCustomer", function(request, response) {
Stripe.Charges.create({
amount: request.params.amount, // in cents
currency: "usd",
customer: request.params.customerId,
},{
success: function (httpResponse) {
console.log(httpResponse);
response.success(httpResponse);
},
error: function (httpResponse) {
console.error(httpResponse.message);
response.error(httpResponse.message);
}
});
});
As you can see, to pass on the variable from objective-c to javascript in this case, you use request.params.