Skip to main content
saved 6 bytes
Source Link
Arnauld
  • 197.6k
  • 20
  • 179
  • 649

JavaScript (V8), 10296 bytes

-3 thanks to @Shaggy
-6 thanks to @tsh

I overlooked the rule allowing anonymous functions, so this generates a full program using either print or console.log with some extra tricks to handleprecaution for n which is present in both instructions.

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

Try it online!Try it online!

JavaScript (V8), 102 bytes

-3 thanks to @Shaggy

I overlooked the rule allowing anonymous functions, so this generates a full program using either print or console.log with some extra tricks to handle n which is present in both instructions.

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

Try it online!

JavaScript (V8), 96 bytes

-3 thanks to @Shaggy
-6 thanks to @tsh

I overlooked the rule allowing anonymous functions, so this generates a full program using either print or console.log with extra precaution for n which is present in both instructions.

s=>`${S="print",S.match(s)?'co\\u006esole.log':S}("\\${s.charCodeAt().toString(8)+s.slice(1)}")`

Try it online!

minor update
Source Link
Arnauld
  • 197.6k
  • 20
  • 179
  • 649

JavaScript (V8), 102 bytes

-3 thanks to @Shaggy

NB: This generates a full program. I overlooked the 2nd rule allowing anonymous functions, so this generates a full program using either print or console.log with some extra tricks to handle n which is present in both instructions.

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

Try it online!

JavaScript (V8), 102 bytes

-3 thanks to @Shaggy

NB: This generates a full program. I overlooked the 2nd rule allowing anonymous functions.

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

Try it online!

JavaScript (V8), 102 bytes

-3 thanks to @Shaggy

I overlooked the rule allowing anonymous functions, so this generates a full program using either print or console.log with some extra tricks to handle n which is present in both instructions.

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

Try it online!

added a note
Source Link
Arnauld
  • 197.6k
  • 20
  • 179
  • 649

JavaScript (V8), 102 bytes

-3 thanks to @Shaggy

There must beNB: This generates a shorter way.full program. I overlooked the 2nd rule allowing anonymous functions.

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

Try it online!

JavaScript (V8), 102 bytes

-3 thanks to @Shaggy

There must be a shorter way...

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

Try it online!

JavaScript (V8), 102 bytes

-3 thanks to @Shaggy

NB: This generates a full program. I overlooked the 2nd rule allowing anonymous functions.

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

Try it online!

saved 3 bytes
Source Link
Arnauld
  • 197.6k
  • 20
  • 179
  • 649
Loading
Source Link
Arnauld
  • 197.6k
  • 20
  • 179
  • 649
Loading