BaseCodeByte
Back to JavaScript outline
JSJavaScriptBeginnerLive runner10 min

Functions and Scope

Functions and Scope with a runnable browser-safe JavaScript example.

Lesson notes

This JavaScript example runs in an isolated worker so console output can be captured safely.

functionsreturn valuesscope

Editable notebook cell

Starter code

1
2
3
4
5
6
7
8

Output

Live runner
Run the code to see output here.

Try this

Change one value, run it again and explain how the output changed.

Hint: Start by changing a string or array value.