# Functions - JavaScript Examples

Using functions on the Azion Web Platform allows you to have closer and faster communication with users. By making use of JavaScript, you're able to effectively perform tasks that have a great impact on people's lives and business on a daily basis.

This collection gathers ready-to-use JavaScript snippets that show common patterns for functions, from returning a simple response or JSON payload to redirecting traffic, reading cookies, running A/B tests, and applying firewall rules based on GeoIP data. The examples are grouped by where they run: functions that respond to the `fetch` event in applications, and functions that handle the `firewall` event for security and request control. To use any of them, copy the code into a function and deploy it on Azion, optionally customizing behavior through args so the same logic can be reused across instances.

---

## Functions - Applications

[A/B testing](/en/documentation/products/applications/functions/javascript-examples/ab-testing/)

[Extract cookie value](/en/documentation/products/applications/functions/javascript-examples/cookie-value/)

[Hello World](/en/documentation/products/applications/functions/javascript-examples/hello-world/)

[Redirect all requests to one URL](/en/documentation/products/applications/functions/javascript-examples/redirect-requests/)

[Respond with another site](/en/documentation/products/applications/functions/javascript-examples/respond-site/)

[Rest APIs](/en/documentation/products/applications/functions/javascript-examples/rest-apis/)

[Return HTML](/en/documentation/products/applications/functions/javascript-examples/return-html/)

[Return JSON](/en/documentation/products/applications/functions/javascript-examples/return-json/)

[Using args](/en/documentation/products/applications/functions/javascript-examples/using-args/)

---

## Functions - Firewall

[Adding a response header](/en/documentation/products/applications/functions/javascript-examples/adding-response-header/)

[Deny a request based on Geoip](/en/documentation/products/applications/functions/javascript-examples/deny-request/)

[General functions on firewall example](/en/documentation/products/applications/functions/javascript-examples/general-firewall-example/)