You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user/JavaScriptCompatibility.md
+16-3Lines changed: 16 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,13 +113,26 @@ Source can be of type:
113
113
* a JavaScript object: the object is queried for a `name` and a `script` property, which represent the source name and code, respectively.
114
114
* all other types: the source is converted to a String.
115
115
116
-
#### `print(...arg)` and `console.log(...arg)`
116
+
#### `print(...arg)`
117
117
118
118
Prints the arguments on the console.
119
119
Provides a best-effort human readable output.
120
120
121
-
Note that `console.log` behaves differently when Graal JavaScript is executed in Node.js mode (i.e., the `node` executable is started instead of `js`).
122
-
While normally, `console.log` is just an alias for `print`, on Node.js Node's own implementation is executed.
121
+
#### Methods of the `console` global object
122
+
123
+
A global `console` object is provided that offers several methods for debugging purposes.
124
+
These methods strive to provide similar functionality as provided in other engines, but do not guarantee identical results.
125
+
126
+
Note that those methods behave differently when Graal JavaScript is executed in Node.js mode (i.e., the `node` executable is started instead of `js`).
127
+
Node.js provides its own implementation that is used instead.
128
+
129
+
*`console.log`, `console.info`, and `console.debug`: an alias for `print(...arg)`
130
+
*`console.error`, and `console.warn`: similar to `print`, but using the error IO stream
131
+
*`console.assert(check, message)`: prints `message` when `check` is falsy
132
+
*`console.clear`: clears the console window if possible
133
+
*`console.count()`, and `console.countReset()`: counts and print how many times it has been called, or resets this counter
134
+
*`console.group`, and `console.groupEnd`: increases or decreases the indentation for succeeding outputs to the console
135
+
*`console.time()`, `console.timeLog()`, and `console.timeEnd()`: starts a timer, prints the duration the timer has been active, or prints the duration and stops the timer, respectively
0 commit comments