--- title: "JS Steps: Examples of Return and Argument Use | Autify Guide" slug: "example-of-using-return-and-argument-at-js-step" description: "Maximize JS Step Efficiency: Learn Examples of Using Return and Argument in Autify. Start your Free Trial!" updated: 2023-09-29T00:44:03Z published: 2023-09-29T00:44:03Z canonical: "help.autify.com/example-of-using-return-and-argument-at-js-step" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.autify.com/llms.txt > Use this file to discover all available pages before exploring further. # Examples of using Return and arguments in JS Steps JS Steps support ***return*** and ***arguments***, which may make it possible to perform actions that you can't achieve with the standard features. In this article, we will look at an example that uses *return* and *arguments*. ### How to Use JS Steps and Dynamic Values We will use JS Steps and the Dynamic Values in this article, but we will not cover the basics of how to use these features. To learn the basics, please refer to the following pages: - [JS Steps](https://help.autify.com/docs/javascript-steps) - [Generating Dynamic Values](https://help.autify.com/docs/en/dynamic-value-generation) ## Example As an example, let's look at how to achieve the following actions: - **Add the fixed character "TEST" in front of the random text generated by the Dynamic Value feature, and enter the returned value "TEST + random text" in an input step.** ### 1. Generate a random text using Dynamic Values First, we want to generate a random text. Add a Dynamic Value step to the scenario and specify **[Random text with specific characters].** In this example, we will use the default settings for its length and characters. ![スクリーンショット 2023-09-22 15.49.00.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202023-09-22%2015.49.00%281%29.png?sv=2026-02-06&spr=https&st=2026-10-30T11%3A30%3A58Z&se=2026-10-30T12%3A30%3A58Z&sr=c&sp=r&sig=RUViCzQ782FPtEW%2F%2FyMnvX8xJAoZVdEVQ7l05Amd4Mw%3D) ### 2. Create a JS Step and add an argument Next, add a JS Step and add an **argument** by clicking **[Add argument]** in the JS Step. ![スクリーンショット 2023-09-22 15.49.41.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202023-09-22%2015.49.41.png?sv=2026-02-06&spr=https&st=2026-10-30T11%3A30%3A58Z&se=2026-10-30T12%3A30%3A58Z&sr=c&sp=r&sig=RUViCzQ782FPtEW%2F%2FyMnvX8xJAoZVdEVQ7l05Amd4Mw%3D) In this example, we will name it **"random"** add the argument. ![スクリーンショット 2023-09-22 15.49.57.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202023-09-22%2015.49.57.png?sv=2026-02-06&spr=https&st=2026-10-30T11%3A30%3A58Z&se=2026-10-30T12%3A30%3A58Z&sr=c&sp=r&sig=RUViCzQ782FPtEW%2F%2FyMnvX8xJAoZVdEVQ7l05Amd4Mw%3D) We want to use the **[Random text with specific characters]** we created in step 1 above, so under **Argument values**, select **[Other step's result]** and specify **[2. Dynamic Value]**. ![スクリーンショット 2023-09-22 15.50.35.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202023-09-22%2015.50.35.png?sv=2026-02-06&spr=https&st=2026-10-30T11%3A30%3A58Z&se=2026-10-30T12%3A30%3A58Z&sr=c&sp=r&sig=RUViCzQ782FPtEW%2F%2FyMnvX8xJAoZVdEVQ7l05Amd4Mw%3D) ### 3. In the JS Step, add "TEST" in front of the random text and return the value The random text specified in [2. Dynamic Value] will be assigned to the **"random"** argument we added in step 2 above, so we will write the following JavaScript to add the fixed string "TEST" in front of the random text. We will also return the value so that we can use it in subsequent steps. ``` return "TEST" + random; ``` ![スクリーンショット 2023-09-22 15.52.31.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202023-09-22%2015.52.31.png?sv=2026-02-06&spr=https&st=2026-10-30T11%3A30%3A58Z&se=2026-10-30T12%3A30%3A58Z&sr=c&sp=r&sig=RUViCzQ782FPtEW%2F%2FyMnvX8xJAoZVdEVQ7l05Amd4Mw%3D) ### 4. Use the returned value in a subsequent step In the Input step in step 4, select **[Other step's result]** and specify **[3. Execute JavaScript]**, which is the JS Step we just created. ![スクリーンショット 2023-09-22 15.53.21.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202023-09-22%2015.53.21.png?sv=2026-02-06&spr=https&st=2026-10-30T11%3A30%3A58Z&se=2026-10-30T12%3A30%3A58Z&sr=c&sp=r&sig=RUViCzQ782FPtEW%2F%2FyMnvX8xJAoZVdEVQ7l05Amd4Mw%3D) When we run the test with this setup, **step 3 returns "TEST + random text"**, and from the screenshot in step 4, we can confirm that the target action was performed correctly. ![スクリーンショット 2023-09-22 16.02.20.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202023-09-22%2016.02.20.png?sv=2026-02-06&spr=https&st=2026-10-30T11%3A30%3A58Z&se=2026-10-30T12%3A30%3A58Z&sr=c&sp=r&sig=RUViCzQ782FPtEW%2F%2FyMnvX8xJAoZVdEVQ7l05Amd4Mw%3D) ![スクリーンショット 2023-09-22 16.02.28.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202023-09-22%2016.02.28.png?sv=2026-02-06&spr=https&st=2026-10-30T11%3A30%3A58Z&se=2026-10-30T12%3A30%3A58Z&sr=c&sp=r&sig=RUViCzQ782FPtEW%2F%2FyMnvX8xJAoZVdEVQ7l05Amd4Mw%3D) As you can see, you can test a wide range of actions using return and arguments. If you have any questions about using JS Steps, please feel free to contact support.