# Functions examples

This section holds the pages of the Functions examples.

- [JavaScript examples](/en/documentation/platform/functions/javascript-examples.md): Copy ready-to-use JavaScript snippets for functions, from returning a response to reading cookies and denying requests on a firewall.
- [A/B testing](/en/documentation/platform/functions/ab-testing.md): Split traffic between two responses in a function, picking a group at random and recording it in a cookie.
- [Add a response header](/en/documentation/platform/functions/adding-response-header.md): Add a response header based on the visitor's country, with a function that runs on a firewall and reads GeoIP metadata.
- [Deny a request by country](/en/documentation/platform/functions/deny-request.md): Block requests from a chosen country before they reach your application, with a function that runs on a firewall.
- [Extract a cookie value](/en/documentation/platform/functions/cookie-value.md): Read a named cookie from the request header in a function and use its value to shape the response you return.
- [Functions on a firewall](/en/documentation/platform/functions/general-firewall-example.md): Deny, drop, modify, or answer a request from one firewall handler, using the event actions available to a function on a firewall.
- [Hello world](/en/documentation/platform/functions/hello-world.md): Return a fixed string from a function, without contacting an origin, and confirm the function is deployed and serving traffic.
- [Process a request body](/en/documentation/platform/functions/process-request-body.md): Read the body of a request inside a function, switching on the Content-Type header to parse JSON, form data, text, binary, and streamed payloads.
- [Redirect all requests to one URL](/en/documentation/platform/functions/redirect-requests.md): Send every incoming request to one destination URL with a 301 redirect returned by a function, before it reaches your origin.
- [Respond with another site](/en/documentation/platform/functions/respond-site.md): Answer a request with content fetched from another site, relaying the upstream response while the browser keeps the original URL.
- [REST APIs](/en/documentation/platform/functions/rest-apis.md): Call a REST API from a function with fetch, using the GET, DELETE, POST, PUT, and PATCH methods with JSON data.
- [Return HTML](/en/documentation/platform/functions/return-html.md): Build an HTML page inside a function and return it with the correct content-type header, without rendering it on an origin server.
- [Return JSON](/en/documentation/platform/functions/return-json.md): Serialize an object and return it as a JSON response with the correct content-type header, for lightweight APIs and middleware.
- [Using args](/en/documentation/platform/functions/using-args.md): Pass JSON Args into a function from its instance and read them at runtime to change behavior without editing code.
