# Chainlink Functions Playground

Navigate to the [Chainlink Functions Playground](https://functions.chain.link/playground) and you will see this page with a simple example:

<figure><img src="https://62720068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNQrWPKDHvXg0HQjwzHbY%2Fuploads%2FBZHoHhrDLPQDQtJ8YrBr%2Ffunctions.png?alt=media&#x26;token=c78a70cb-42fc-4620-9281-2f1dd8ab22b5" alt=""><figcaption><p>Chainlink Functions Playground</p></figcaption></figure>

### Inputs

1. Your Source code
2. Your Argument(s)
3. Your Secret, if any

When you are ready to run your code:

* &#x20;click the  “Run Code” button (#4) at the bottom left &#x20;
* your  "Output" (#5) will appear on the right hand side. In this traditional example, you get the `string` back "Hello World!"

***

### Star Wars Example

Back in the Chainlink Functions Playground, click the drop-down menu on the upper right called “Fill with example code” (#1) and  click the “Star Wars characters” example (#2):

<figure><img src="https://62720068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNQrWPKDHvXg0HQjwzHbY%2Fuploads%2FKQGZoPhS9Q57VHq6I9sK%2Ffunctions1.png?alt=media&#x26;token=85d38669-8982-411f-bb43-c4977fdc0d4b" alt=""><figcaption></figcaption></figure>

The JavaScript source code will be loaded for your project.&#x20;

1. This is the first argument, which is the `characterId` you want to retrieve information about. `args` gets injected into your source code at runtime.  More on that later!
2. Then, a HTTP request is made to the URL: `https://swapi.info/api/people/${characterId}` using the `Functions` library that is also injected into the source code at run time.

<figure><img src="https://62720068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNQrWPKDHvXg0HQjwzHbY%2Fuploads%2FfaCmL7PVK7lNGc6gcX9I%2Ffunctions2.png?alt=media&#x26;token=9853a4ba-1f78-4d3a-8b53-99821a3c5765" alt=""><figcaption></figcaption></figure>

Let's assume that your first argument (which gets assigned to `characterId` ) is 1.  If you go to that link ([https://swapi.info/api/people/1/](https://swapi.info/api/people/$%7BcharacterId%7D/)) a you will see the following information:

<figure><img src="https://62720068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNQrWPKDHvXg0HQjwzHbY%2Fuploads%2FdFZwG48yhC5VNIEuDmCp%2Ffunctions3.png?alt=media&#x26;token=90453050-95ee-4550-807d-4e2702776168" alt=""><figcaption><p>Luke Skywalker</p></figcaption></figure>

This has various information about the Star Wars character Luke Skywalker. You can change the argument `1` to `2` and so on for other Star Wars characters.

{% hint style="info" %}
Hint:`4` is Darth Vader!&#x20;
{% endhint %}

Now back at the Playground, pass your arguments to the source code using the text input boxes.  Put `1` as shown in the image (#1) and and  click the “Run Code” (#2) blue  button.

&#x20;You will see the “Console log”  and "Output" data on the right with all the information on Luke Skywalker:

<figure><img src="https://62720068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNQrWPKDHvXg0HQjwzHbY%2Fuploads%2FUPIecD0d3wPhThz8UD8k%2Ffunctions4.png?alt=media&#x26;token=fcebb21d-ab00-4ff3-82a6-9abf10fb67bc" alt=""><figcaption></figcaption></figure>

By utilizing the Chainlink Functions Playground, you verify your code to make sure it works before you put that into your contracts. Pretty neat, huh?
