Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 4 characters in body
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241

Japt, 29 bytes

With spaces:

`Co ̧{S}Golf`r `PžgŸmÚÁ Puzz¤s

Try it online!

Without spaces:

`Co ̧{S}Golf`r`PžgŸmÚÁPuzz¤s

Try it online!


This takes advantage of the fact that in Japt, a space closes a method call. With spaces, the code is roughly equivalent to this JavaScript code:

("Code"+(S)+"Golf").r(),"Programming Puzzles"

This is evaluated as JavaScript, and the result is sent to STDOUT. Since the last expression is "Programming Puzzles", that string is printed.

Without spaces, the code is roughly equivalent to:

("Code"+(S)+"Golf").r("ProgrammingPuzzles")

(If you haven't figured it out by now, the S variable is a single space.) The .r() method on a string, if given one argument, removes all instances of that argument from the string. Since "Code Golf" does not contain "ProgrammingPuzzles", it returns the "Code Golf" unchanged, which is then sent to STDOUT.

Japt, 29 bytes

With spaces:

`Co ̧{S}Golf`r `PžgŸmÚÁ Puzz¤s

Try it online!

Without spaces:

`Co ̧{S}Golf`r`PžgŸmÚÁPuzz¤s

Try it online!


This takes advantage of the fact that in Japt, a space closes a method call. With spaces, the code is roughly equivalent to this JavaScript code:

("Code"+(S)+"Golf").r(),"Programming Puzzles"

This is evaluated as JavaScript, and the result is sent to STDOUT. Since the last expression is "Programming Puzzles", that string is printed.

Without spaces, the code is roughly equivalent to:

("Code"+(S)+"Golf").r("ProgrammingPuzzles")

(If you haven't figured it out by now, the S variable is a single space.) The .r() method on a string, if given one argument, removes all instances of that argument from the string. Since "Code Golf" does not contain "ProgrammingPuzzles", it returns the "Code Golf" unchanged, which is then sent to STDOUT.

Japt, 29 bytes

With spaces:

`Co ̧{S}Golf`r `PžgŸmÚÁ Puzz¤s

Try it online!

Without spaces:

`Co ̧{S}Golf`r`PžgŸmÚÁPuzz¤s

Try it online!


This takes advantage of the fact that in Japt, a space closes a method call. With spaces, the code is roughly equivalent to this JavaScript code:

("Code"+(S)+"Golf").r(),"Programming Puzzles"

This is evaluated as JavaScript, and the result is sent to STDOUT. Since the last expression is "Programming Puzzles", that string is printed.

Without spaces, the code is roughly equivalent to:

("Code"+(S)+"Golf").r("ProgrammingPuzzles")

(If you haven't figured it out by now, the S variable is a single space.) The .r() method on a string, if given one argument, removes all instances of that argument from the string. Since "Code Golf" does not contain "ProgrammingPuzzles", it returns "Code Golf" unchanged, which is then sent to STDOUT.

added explanation
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241

Japt, 29 bytes

With spaces:

`Co ̧{S}Golf`r `PžgŸmÚÁ Puzz¤s

Try it online!

Without spaces:

`Co ̧{S}Golf`r`PžgŸmÚÁPuzz¤s

Try it online!


This takes advantage of the fact that in Japt, a space closes a method call. With spaces, the code is roughly equivalent to this JavaScript code:

("Code"+(S)+"Golf").r(),"Programming Puzzles"

This is evaluated as JavaScript, and the result is sent to STDOUT. Since the last expression is "Programming Puzzles", that string is printed.

Without spaces, the code is roughly equivalent to:

("Code"+(S)+"Golf").r("ProgrammingPuzzles")

(If you haven't figured it out by now, the S variable is a single space.) The .r() method on a string, if given one argument, removes all instances of that argument from the string. Since "Code Golf" does not contain "ProgrammingPuzzles", it returns the "Code Golf" unchanged, which is then sent to STDOUT.

Japt, 29 bytes

With spaces:

`Co ̧{S}Golf`r `PžgŸmÚÁ Puzz¤s

Try it online!

Without spaces:

`Co ̧{S}Golf`r`PžgŸmÚÁPuzz¤s

Try it online!

Japt, 29 bytes

With spaces:

`Co ̧{S}Golf`r `PžgŸmÚÁ Puzz¤s

Try it online!

Without spaces:

`Co ̧{S}Golf`r`PžgŸmÚÁPuzz¤s

Try it online!


This takes advantage of the fact that in Japt, a space closes a method call. With spaces, the code is roughly equivalent to this JavaScript code:

("Code"+(S)+"Golf").r(),"Programming Puzzles"

This is evaluated as JavaScript, and the result is sent to STDOUT. Since the last expression is "Programming Puzzles", that string is printed.

Without spaces, the code is roughly equivalent to:

("Code"+(S)+"Golf").r("ProgrammingPuzzles")

(If you haven't figured it out by now, the S variable is a single space.) The .r() method on a string, if given one argument, removes all instances of that argument from the string. Since "Code Golf" does not contain "ProgrammingPuzzles", it returns the "Code Golf" unchanged, which is then sent to STDOUT.

Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241

Japt, 29 bytes

With spaces:

`Co ̧{S}Golf`r `PžgŸmÚÁ Puzz¤s

Try it online!

Without spaces:

`Co ̧{S}Golf`r`PžgŸmÚÁPuzz¤s

Try it online!

AltStyle によって変換されたページ (->オリジナル) /