Skip to main content
1 of 5
Arnauld
  • 197.6k
  • 20
  • 179
  • 649

JavaScript (V8), 105 bytes

There must be a shorter way...

s=>`${S="print",~S.indexOf(s)?'eval("co\\156sole.log")':S}("\\${s.charCodeAt().toString(8)+s.slice(1)}")`

Try it online!

Arnauld
  • 197.6k
  • 20
  • 179
  • 649