document functino nr args

This commit is contained in:
2026-02-16 18:53:53 -06:00
parent 17e35f023f
commit c02945e236
2 changed files with 8 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ All code uses 2 spaces for indentation. K&R style for C and Javascript.
- No classes — only objects and prototypes (`meme()`, `proto()`, `isa()`)
- No `for...in`, `for...of`, spread (`...`), rest params, or default params
- No named function declarations — use `var fn = function() {}` or arrow functions
- Functions have a maximum of 4 parameters — use a record for more
- Variables must be declared at function body level only (not in if/while/for/blocks)
- All variables must be initialized at declaration (`var x` alone is an error; use `var x = null`)
- No `try`/`catch`/`throw` — use `disrupt`/`disruption`

View File

@@ -398,6 +398,8 @@ fn2() // 1
### Arguments
Functions can have at most **4 parameters**. Use a record to pass more values.
Extra arguments are ignored. Missing arguments are `null`.
```javascript
@@ -406,6 +408,11 @@ fn(1, 2, 3) // 3 (extra arg ignored)
var fn2 = function(a, b) { return a }
fn2(1) // 1 (b is null)
// More than 4 parameters — use a record
var draw = function(shape, opts) {
// opts.x, opts.y, opts.color, ...
}
```
### Immediately Invoked Function Expression