2022-10-21 11:16:00 -04:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home ](./index.md ) > [bitburner ](./bitburner.md ) > [NS ](./bitburner.ns.md ) > [args ](./bitburner.ns.args.md )
## NS.args property
Arguments passed into the script.
2023-02-11 13:18:50 -05:00
**Signature:**
2022-10-21 11:16:00 -04:00
```typescript
2024-04-23 17:21:05 -07:00
readonly args: ScriptArg[];
2022-10-21 11:16:00 -04:00
```
## Remarks
RAM cost: 0 GB
2022-11-24 08:19:51 -05:00
Arguments passed into a script can be accessed as a normal array by using the `[]` operator (`args[0]` <!-- --> , `args[1]` <!-- --> , etc...). Arguments can be string, number, or boolean. Use `args.length` to get the number of arguments that were passed into a script.
2022-10-21 11:16:00 -04:00
2023-02-14 01:32:01 -05:00
## Example
2022-11-24 08:19:51 -05:00
`run example.js 7 text true`
```js
2023-02-14 01:32:01 -05:00
// example.js
2022-11-24 08:19:51 -05:00
export async function main(ns) {
ns.tprint(ns.args.length) // 3
ns.tprint(ns.args[0]); // 7 (number)
ns.tprint(ns.args[1]); // "text" (string)
ns.tprint(ns.args[2]); // true (boolean)
ns.tprint(ns.args[3]); // undefined, because only 3 arguments were provided
}
```
2022-10-21 11:16:00 -04:00