Skip to content

Instantly share code, notes, and snippets.

@femioladeji
Created April 9, 2019 14:00
Show Gist options
  • Save femioladeji/b5e23dbaca015d9235ffa81c6db975c3 to your computer and use it in GitHub Desktop.
Save femioladeji/b5e23dbaca015d9235ffa81c6db975c3 to your computer and use it in GitHub Desktop.
aws lambda function tutorial
const roundNumber = (number, decimlPlaces) => {
return Number((Math.round(number + `e${decimlPlaces}`)) + `e-${decimlPlaces}`);
}
exports.handler = async (event) => {
const number = 4.356;
const decimalPlaces = 2;
const answer = roundNumber(number, decimalPlaces);
const response = {
statusCode: 200,
body: answer,
};
return response;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment