diff options
Diffstat (limited to 'tests/specs/repl/console_log/093_console_log_format.js')
-rw-r--r-- | tests/specs/repl/console_log/093_console_log_format.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/specs/repl/console_log/093_console_log_format.js b/tests/specs/repl/console_log/093_console_log_format.js new file mode 100644 index 000000000..15022411c --- /dev/null +++ b/tests/specs/repl/console_log/093_console_log_format.js @@ -0,0 +1,16 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +class Frac { + constructor(num, den) { + this.num = num; + this.den = den; + } + [Symbol.toPrimitive]() { + return this.num / this.den; + } + display() { + const result = this.num / this.den; + process.stdout.write(`${result}`); + } +} +const f = new Frac(1, 2); +f.display(); |