const util = require(
'util'
);
console.log(
"1.>"
, util.format(
'%%: %s'
,
'abc'
,
'def'
, -0));
console.log(
"2.>"
, util.format(
'%%'
,
'abc'
,
'def'
,
'ghi'
));
console.log(
"3.>"
, util.format(
'%s'
,
'abc'
, 94321321321223372036854775807));
console.log(
"4.>"
, util.format(
'%s'
,
'abc'
, Object.create(
null
,
{
[Symbol.toStringTag]:
{ value:
'def'
}
})));
console.log(
"5.>"
, util.format(
'%d'
,
'abc'
, 94303685));
console.log(
"6.>"
, util.format(
'%i'
,
'2020 year 2021, '
,
'He was 40,'
,
'10.33, '
,
'10, '
, 10));
console.log(
"7.>"
, util.format(
'%f'
,
'94321321321.564000 year 6546'
,
'abc'
, 943036854775807));
console.log(
"8.>"
, util.format(
'%j'
,
'{ "name":"John", "age":31, "city":"New York" }'
,
'abc'
, 943036854775807));
console.log(
"9.>"
, util.format(
'%o'
,
class Bar { },
'abc'
, 943036854775807));
console.log(
"10.>"
, util.format(
'%o:%d'
,
class Foo {
get [Symbol.toStringTag]() {
return
'abc'
; }
},
'abc'
,
943036854775807
));
class randomClass { }
console.log(
"11.>"
,
util.inspect(
new
randomClass()));