Practical WebAssembly implementations and common use cases in action.
(module
(func $add (param $a i32) (param $b i32) (result i32)
get_local $a
get_local $b
i32.add)
)
Basic addition function in WebAssembly text format.
(module
(memory $memory 1)
(data (i32.const 0) "Hello, WebAssembly!")
)
Demonstrates linear memory and data initialization.
(module
(func $factorial (param $n i32) (result i32)
get_local $n
i32.const 1
i32.eq
if (result i32)
i32.const 1
else
get_local $n
i32.const 1
i32.sub
call $factorial
get_local $n
i32.mul
end
)
)
Recursive factorial calculation with WebAssembly.
(module
(import "env" "log" (func $log (param i32)))
(func $main ()
i32.const 42
call $log
)
)
Shows integration with JavaScript host functions.
Start experimenting with these code samples and bring your ideas to life.
📚 View Documentation