Skip to content

Instantly share code, notes, and snippets.

@leumasme
Created April 12, 2025 15:31
Show Gist options
  • Save leumasme/293687234994a1ec0662431faf7e9d65 to your computer and use it in GitHub Desktop.
Save leumasme/293687234994a1ec0662431faf7e9d65 to your computer and use it in GitHub Desktop.
Javascript Python Polyglot

I just watched https://www.youtube.com/watch?v=dbf9e7okjm8 and wanted to come up with my own, better solution.

This took just a few minutes for me to find.
I came up with it myself, inspired by the video, but i don't doubt that a solution like this was likely already found before

1 // 1, """
/*
"""
print("This only executes in python!")
"""
*/
1 // 1, """
1 // 1, """
console.log("This only executes in javascript")
1 //"""
1 // 1, """
/*
"""
print("This only executes in python!")
"""
*/
1 // 1, """
1 // 1, """
console.log("This only executes in javascript")
1 //"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment