Console
The global console object is available in every program without an import. Each method prints a
string followed by a newline.
console.log
Writes a string to standard output.
console.log("Hello, World!");console.log("Zeus supports UTF-8 🚀");
let greeting: string = "Welcome to Zeus!";console.log(greeting);Output:
Hello, World!Zeus supports UTF-8 🚀Welcome to Zeus!console.error and console.info
console.error writes to standard error; console.info writes to standard output. Both otherwise
behave like console.log.
console.log("normal output"); // stdoutconsole.info("informational"); // stdoutconsole.error("went wrong"); // stderrLogging byte arrays
A u8[] converts implicitly to string, so you can print raw bytes by assigning them to a string
first:
let bytes: u8[] = new u8[];bytes[0] = 'H';bytes[1] = 'i';
let text: string = bytes; // u8[] -> stringconsole.log(text); // "Hi"