Utilities
util.format()
Creates a formatted string using supported placeholders. Extra values and non-string first arguments follow Node formatting rules; output is not a serialization contract.
Formal Syntax & Structure
nodejs syntaxnodejs
util.format(format[, ...args])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| format | any | First value or format string. |
| args | any[] | Additional values. |
Return Value
string
Formatted diagnostic text.
Working Example
Example Snippetnodejs
import { format } from "node:util";console.log(format("Count: %d", 4));