Skip to content

Undefined

Chung Leong edited this page Apr 10, 2024 · 7 revisions

The literal undefined in Zig is represented as undefined in JavaScript. You will only encounter it if you explicitly export undefined.

pub const Undefined = undefined;
import { Undefined } from './undefined-example-1.zig';

console.log(Undefined);
undefined

Assigning undefined to a variable would not yield undefined on the JavaScript side.

pub var number: i32 = undefined;
import module from './undefined-example-2.zig';

console.log(module.number);
0
Clone this wiki locally