JavaScript Is Weird (EXTREME EDITION)

Поделиться
HTML-код
  • Опубликовано: 22 авг 2019
  • To offset some of the banana-based JavaScript "weirdness" that's making the rounds, I'm bring you a 40 line JSFuck compiler that turns innocent looking JS into a mess of obfuscated symbols.
    =[ 🔗 Links 🔗 ]=
    - ⭐️ Patreon: / lowleveljavascript
    - 💌 Updates to your inbox: tinyletter.com/lowleveljavasc...
    - Martin Kleppe's Original JSFuck: www.jsfuck.com/
    - Martin on Twitter: / aemkei
    - Parser Combinators From Scratch Series: • How Parser Combinators...
    - Github repo: github.com/LowLevelJavaScript...

Комментарии • 945

  • @__8120
    @__8120 Год назад +1366

    JavaScript refusing to crash no matter what two random things you add together has the same energy as being able to kill any npc in new vegas and the story managing to continue on

    • @mothcatcher893
      @mothcatcher893 Год назад +10

      @@miike2 That sounds pretty interesting, do you not remember what rpg it was?

    • @triffinne
      @triffinne Год назад +4

      @@miike2 This sounds vaguely familiar... Some late 90's pc game? Every time I try to think too hard about it I end up picturing baldur's gate but I don't think that was it 🤔

    • @gurmyigoll3535
      @gurmyigoll3535 Год назад +1

      @@miike2 I don't think this is the game but the ability to speak with dead NPCs was something you could do in Arcanum with the "Conjure Spirit" spell

    • @danibiyarslanov
      @danibiyarslanov Год назад +3

      New vegas may have been made in javascript then

    • @Kalimangard
      @Kalimangard 6 месяцев назад

      ​@@triffinne I think deus ex had something like that.

  • @ricardoamendoeira5689
    @ricardoamendoeira5689 4 года назад +2577

    I was expecting you to compile this compiler in itself at the end, that would have been the cherry on top of this amazing exercise!

    • @LowByteProductions
      @LowByteProductions  4 года назад +920

      Yeah I often think back on this and lick myself

    • @samihbezaa7960
      @samihbezaa7960 3 года назад +384

      @@LowByteProductions LLJS is a furry confirmed

    • @Rudxain
      @Rudxain 2 года назад

      Booty-strapping lol

    • @dagbroad
      @dagbroad 2 года назад +168

      @@samihbezaa7960 well he does write code

    • @williamist
      @williamist 2 года назад +63

      @@dagbroad that would do it

  • @SlykeThePhoxenix
    @SlykeThePhoxenix 5 лет назад +3350

    Thanks for this. You just ensured my job security for the next 10 years.
    Lord have mercy on my replacement.

    • @dAtramt
      @dAtramt 5 лет назад +106

      SlykeThePhoxenix Hahaha. you evil genius.

    • @jidaasare7021
      @jidaasare7021 4 года назад +52

      This comment literally made my day

    • @vardamanpk
      @vardamanpk 4 года назад +36

      This comment deserves more likes than the actual video. ha ha..

    • @tyrrelldavis9919
      @tyrrelldavis9919 3 года назад +18

      Idk man I'm not buying it..
      The people that comment on here that say they work in this industry.
      I think alot of the comments are people pretending.
      Which can create a false pretense sometimes :(

    • @seanpaulson9098
      @seanpaulson9098 3 года назад +1

      Lmao

  • @marchmelloow
    @marchmelloow 2 года назад +604

    Finally a good JavaScript tutorial. Was just getting into learning the language. You're a lifesaver

    • @boumbh
      @boumbh Год назад +49

      Thanks to that I may finally be able to write readable JavaScript!

  • @jasarwadlow9406
    @jasarwadlow9406 Год назад +65

    Security advisor: Never store secrets in frontend code!
    Me: hold my beer.

    • @kyomawolf2
      @kyomawolf2 6 месяцев назад +1

      BEHOLD, this litttle trick will kill you!
      eval()

  • @Deloxo
    @Deloxo 2 года назад +770

    ok, not gonna lie
    I died when it became obvious that the banana function was outputting a hidden NaN
    I never knew that, that's hilarious

  • @zealiskander
    @zealiskander 2 года назад +534

    I've just discovered your video and thought it'd be funny to make a quine out of it. The resulting file weighs 7MB and is absolutely unreadable. Pretty cool tho.

  • @dAtramt
    @dAtramt 5 лет назад +413

    Well that was genuinely fun in the most nerdiest possible way

  • @JobvanderZwan
    @JobvanderZwan 5 лет назад +279

    Me after you claiming that all valid JS can be written in JSFuck and that it's really easy to write a JSFuck compiler: "this video better end with a JSFuck compiler compiled to JSFuck, making it self-hosting"

    • @LowByteProductions
      @LowByteProductions  5 лет назад +82

      Man I'm kicking myself now

    • @JobvanderZwan
      @JobvanderZwan 5 лет назад +5

      Don't worry, "construxtor" more than made up for it! :D I immediately pictured an esolang designed to evoke 90s nostalgia or something.
      Also, I minified your implementation down to 941 chars (linked gist). Compiling itself the output becomes over 6 MiB. I haven't managed to run it yet, hahaha
      gist.github.com/JobLeonard/eeffa803b4e9026ab1c68aa9a4fdc0b2

    • @LowByteProductions
      @LowByteProductions  5 лет назад +47

      haha wow nice man! Would be fun to try and golf this down as far as possible to the most minimal JSFuck compiler.

    • @LowByteProductions
      @LowByteProductions  5 лет назад +48

      Well I'm only using the minimum number of characters in the map in order to get to fromCharCode
      But characters generated that way have a huge footprint. I'm throwing away tons of useful and small footprint characters. It's kind of like a JSFuck speed run

    • @kjl3080
      @kjl3080 4 года назад +4

      Low Level JavaScript remind myself to work on this later

  • @JustAGenericHero
    @JustAGenericHero 2 года назад +150

    Adding < would allow to optimize the code a lot because it allows bit shifting to the left (

    • @Essence1123
      @Essence1123 2 года назад +46

      This guy uses way more symbols than necessary so I don't see why he wouldn't allow it. The minimum that I know of is 6 characters: [, ], (, ), +, !.

    • @CraftIP
      @CraftIP 2 года назад +8

      @@Essence1123 oh so no jQuery is needed
      that's rather interesting

    • @sgbench
      @sgbench 2 года назад +37

      @@CraftIP There is no jQuery in this video

    • @louiscoolguy
      @louiscoolguy Год назад +10

      Well the years stop coming and they don’t stop coming, so your fine.

    • @BusinessWolf1
      @BusinessWolf1 Год назад +6

      bro by sheer virtue of the fact that you used low level Js you are extremely sharp. most people never even experiment with coercion beyond a + 1

  • @andythedishwasher1117
    @andythedishwasher1117 2 года назад +379

    Lesson of the day: If you are relying on data structures to protect your data in JS, you are probably not protecting your data.

    • @liranpiade4499
      @liranpiade4499 2 года назад +1

      What do you mean?

    • @bluerendar2194
      @bluerendar2194 2 года назад +20

      @@liranpiade4499 implicit casting means you can probably extract the data into a different data structure behind the scene, and then extract that data out through that different structure.
      Let's say I use a "write-only string" structure to save passwords, where only other parts of the program should be able to access it. If somehow the rest of the program can be finagled into (or already has the bug to) casting it into a normal string, it can then be read out by an attacker even when the original "write-only string" shouldn't allow it.

    • @triston2735
      @triston2735 2 года назад +35

      @@mastery4667 Everything in client side javascript is exploitable. Don't ever trust the client, don't rely on its information, and don't pass it sensitive information. Javascript is incredibly easy to modify, read, and you can easily intercept and change data in real time.

    • @es68951
      @es68951 2 года назад +18

      Correction: If you are writing JS, you are not protecting your data 😂

    • @gaymerjerry
      @gaymerjerry Год назад +1

      just dont use javascript to protect data its a frontend scripting language meaning anyone can inspect your webpage and just grab your js code only ever put protected information in backend scripts like php

  • @PhoenixClank
    @PhoenixClank 2 года назад +258

    Storing this as obfuscated production code on a server would probably lead to faster page loads because although the file is huge, it will be gzipped in transport, and with so few distinct characters and so many repeating patterns it probably compresses really well!

    • @MechMK1
      @MechMK1 2 года назад +215

      Unfortunately not. Even though it uses few characters, the patterns in the file have high entropy, thus it compresses very poorly. Think about the fact that every file deep down is represented in binary, which uses only two "characters", yet that fact alone does not aid compression.
      Further, not only will the file be very large, it will also execute much slower than regular javascript, and will use up way more CPU cycles (which is a problem for mobile users).
      The only "advantage" it would have is that it would slightly obscure the code, but not really. Just how it's possible to write a transpiler from JS to JSFuck, the reverse is also possible.

    • @PhoenixClank
      @PhoenixClank 2 года назад +90

      @@MechMK1 after writing that comment I realized I've been a bit dumb. The huge file shown at the end of the video is just a simple Hello World, so the incredible size bloat would probably offset any compression benefits.
      About the obfuscation, I realized most of this "fucky" code just generates a string that is the original JS, which is then getting eval'd, so it'd actually be trivial to reverse the obfuscation by just chopping off the last step.
      Someone else in the comments did some profiling and didn't notice any significant speed differences in running normal and "fucked" code. Apparently there's a huge difference in amount of RAM used, though (which is not very surprising).

    • @Sihgilanu
      @Sihgilanu 2 года назад +6

      @@PhoenixClank You'd have to eval the output file to reverse the obfuscation though. The compiler isn't ever going to be in the equation for obfuscated files; it would always be on team red's side. And the compiler turns the code into character-salad but JS still recognizes it as genuine code.
      If it's trivial to reverse the obfuscation, do it. Do it without the compiler-- just the output file.

    • @agma
      @agma 2 года назад +6

      I guess it cannot compress better, because for that the patterns must be simpler than those in the original text. That's probably not true since the transformed code is a per-character mapping preserving all patterns in the original text

    • @gnikdroy
      @gnikdroy 2 года назад +24

      While comments stating that this would compress poorly with gzip in particular are correct, with a perfect compression algorithm for this use case they would compress the same.
      A perfect compression algorithm (one for the obfuscated and one for the non obfuscated) would compress both things to the same amount of bits due to Shanon's coding theorem.
      A very easy way to see this is because the source code obfuscated code conversion can happen trivially. source code -> obfuscated code was shown in this video, but the reverse can happen using the javascript runtime to evaluate the source.
      So if the best compression algorithm for normal JS was C1, then your new compression algorithm C2 can deobfuscate the code and run C1, and at the receiving end do the reverse.

  •  Год назад +38

    The worst part about the banana thing is it's actually one of the few examples of JS being perfectly reasonable.

    • @FurryDanOriginal
      @FurryDanOriginal 9 месяцев назад +5

      Imo it should just throw an error and get rid of the NaN value altogether.

  • @gormster
    @gormster 2 года назад +124

    I just spent a not insignificant amount of time trying to improve the method for generating capital C. It's really surprisingly difficult. I couldn't find a way that didn't involve using the Function constructor to basically get an eval, after which it's fairly simple.

    • @mzak5204
      @mzak5204 2 года назад +1

      I’m not familiar with JavaScript but in c# I would subtract the character c by 32 to get the capital C. The minus symbol is allowed but would it work ?

    • @DreadKyller
      @DreadKyller 2 года назад +18

      @@mzak5204 Unfortunately to do so you can'y just use 'c' - 32 or you'd get NaN. You'd need to call 'c'.charCodeAt(0) (or 'c'['charCodeAt'](0)) to get the numeric code, subtract, and then call String.fromCharCode(code). And as you can see both of those require characters we don't have including the character we're trying to solve for. Hard to make a function for "C" if you need to already know "C" to do so. For the same reasoning the idea of getting 'c' how they did 'd' and then calling toUpperCase doesn't work either as it also depends on it's own character.
      He uses the fromCharCode in the video, but note that it still relies on C already being defined.

    • @mzak5204
      @mzak5204 2 года назад +7

      @@DreadKyller thanks for explaining! For JavaScript having so many type coercions I thought it would convert char to integer.. but. I guess not

    • @thelemasathanas
      @thelemasathanas 2 года назад +12

      I've found using the keyboard is probably the quickest means. Admittedly I do not code.

    • @gormster
      @gormster 2 года назад +16

      @@mzak5204 there’s actually no char type in JS. A character is just a string of length 1. There’s also no integer type. It’s uh… a special language.

  • @0mer870
    @0mer870 3 года назад +38

    I'm a beginner in JavaScript and this is just ... Amazing

  • @barmetler
    @barmetler 2 года назад +39

    I actually was able to do a lot of that myself, but using the function constructor to return escape, and using that to escape the backslash... I would not have been able to come to that conclusion in a million years.

  • @BlasterKat101
    @BlasterKat101 2 года назад +53

    I cackled manically through this whole video. This is the chaotic good we need in the world ❤️

  • @Dunkle0steus
    @Dunkle0steus Год назад +20

    If you had extracted all possible easy letters from your early steps instead of just the bare minimum necessary letters, you could probably make the final code a lot shorter. The insane lengths of code to get the char value of O would be reduced if you'd just used the O in [object Object]

  • @Jeacom
    @Jeacom 4 года назад +53

    Suddenly I got a weird liking to JS.

    • @materialknight
      @materialknight Год назад +2

      We generally like what we understand and makes sense to us.

  • @Felipera_
    @Felipera_ 5 лет назад +12

    Watchimg this during lunch break at Brazil JS conf lol

  • @briansivieri5797
    @briansivieri5797 2 года назад +16

    Thanks, now my will to study javascript is equal to '+[]'

  • @basicmountaingriff
    @basicmountaingriff 2 года назад +5

    I love this because it's like one of those videos where somebody breaks Pokémon gen 1's item bag to execute arbitrary code... except for JavaScript.
    This is a JavaScript challenge run.

  • @barnabasszabolcs8708
    @barnabasszabolcs8708 2 года назад +9

    This. Is. Amazing. It is so nice to see how this is properly built up!
    Thanks for the explanation!

  • @ihateevilbill
    @ihateevilbill 2 года назад +6

    I couldnt help it. I laughed involuntarily when map.d worked. I mean, I saw where you were going, but all that code for a simple "d"... thats a thing of beauty right there XD

  • @benjii_boi
    @benjii_boi 2 года назад +65

    When I sat down at my computer this morning I didn't expect to end up watching a video on how to write a JSFuck compiler
    Fantastically presented. I've been a fan of Esolangs since I got in to coding, and always wondered about the finer details of how JSFuck worked
    BrainFuck is honestly easier to understand, simply moving around different memory registers and incrementing/decrementing at the bit level
    The bizarre malleability of JS lends itself to being exceptionally hard to understand why things are happening without examples like this. Brilliant work

    • @RagbagMcShag
      @RagbagMcShag 2 года назад

      Yeah you just get weird bugs and don't know why they are happening, then you remember you are coding in JavaScript

  • @elosonoro1284
    @elosonoro1284 4 года назад +17

    It's a bit long but some xss checkers might ignore it

  • @AsmodeusMictian
    @AsmodeusMictian Год назад +1

    What in the flying blue fuzzy hell did I just watch? This is amazingly done even if I just barely understand what the heck you did :D

  • @stridebird
    @stridebird Год назад +1

    Awesome! I love this, it's very, very twisted but so illuminating too.

  • @perodactyl490
    @perodactyl490 2 года назад +8

    You can use the constructor of the constructor to save on using an arrow function

  • @user-ug8qc6tr6b
    @user-ug8qc6tr6b 4 года назад +5

    This video is pure brilliant as well your other content!

  • @raptoress6131
    @raptoress6131 2 года назад +3

    That JS without letters or numbers is coming back to haunt me in my nightmares...

  • @bobuccman1424
    @bobuccman1424 2 года назад +20

    the power of c: since characters and integers are essentially the same thing, char var = 91; var is 'a'

    • @LowByteProductions
      @LowByteProductions  2 года назад +3

      Yep - that would make life a whole lot easier for this!

    • @almightyhydra
      @almightyhydra 2 года назад

      97, surely? (91 is '[')

    • @bobuccman1424
      @bobuccman1424 2 года назад +1

      @@almightyhydra i said that at like 2am sorry

    • @oonmm
      @oonmm 2 года назад

      C++ > C

  • @erin1569
    @erin1569 Год назад +3

    Btw, this is one way to obfuscate your js, fortunately, there are websites that convert it back into readable code, but they often lack the means to deobfuscate the definitions of variables.

  • @markcalcagno676
    @markcalcagno676 2 года назад +3

    I just started learning JavaScript today, so this video is like watching a foreign film when all you know is the alphabet

  • @DanielTateNZ
    @DanielTateNZ 5 лет назад

    Your channel is dope man just found it ill be watching all of your stuff

  • @RossWasTaken
    @RossWasTaken Год назад +3

    You explained it so well, even I partially understood it!

  • @matthewparker9276
    @matthewparker9276 2 года назад +125

    Could you use string concatenation on the numbers to get the larger number with a shorter string, then cast to a number and back to a string?
    I don't know if I've explained what I'm suggesting very well, but could you instead of having 10 be 1+1+1+1+1+1+1+1+1+1, could it be '1'+'0'? This could reduce the output file sizes a lot, and shouldn't increase the size of the compiler too much.

    • @EragonShadeslayer
      @EragonShadeslayer 2 года назад +15

      I’ve thought of this in different contexts, for working with math in really big numbers in JS. I think that you’re right, it would be quicker.

    • @guyingrey1072
      @guyingrey1072 2 года назад +26

      It'd also be absolutely needed if you wanted to create numbers in the billions, otherwise your file becomes unnecessarily GBs in size.

    • @m.sierra5258
      @m.sierra5258 2 года назад +1

      How do you get '1' and '0'? The string, I mean, not the number.

    • @KaiHenningsen
      @KaiHenningsen 2 года назад

      @@m.sierra5258 number+[] ?

    • @yugiohk574
      @yugiohk574 2 года назад +26

      @@m.sierra5258 just cast the number to string, he literally did it multiple times in the video.

  • @dasten123
    @dasten123 2 года назад +15

    I don't understand the mapping of the backslash. It's at line 33 in 12:06
    Because a backslash is used on both sides there... so in order to get a backslash, a string is used which contains a backslash(?) That doesn't make sense to me. Also, backslash is an allowed character, so why do we need that in the map anyway?
    ... I think I have missed something 🤔

    • @LowByteProductions
      @LowByteProductions  2 года назад +2

      Well we're turning the *string* '\' into an evaluatable representation - so if that was in the original code, we need something we can run to turn it back into that string. It's not strictly necessary - we could have just gotten it through the catch all 'fromCharCode' part, but it was an easy one to throw in.

    • @andriivyshnevetskyi3672
      @andriivyshnevetskyi3672 2 года назад

      @@LowByteProductions Don't we need the backslash defined before the 'fromCharCode' part to get 'C'?

  • @hasashin
    @hasashin 2 года назад +2

    Man, you just created JS version of BainF*ck xD That's excellent. I'm loving it

    • @LowByteProductions
      @LowByteProductions  2 года назад +4

      Thanks glad you enjoyed it. I can't take credit, however. Martin Kleppe was the originator of JSFuck, and he still produces a ton of crazy projects to this day.

  • @free_programming
    @free_programming 2 года назад +1

    My understanding about this:
    My brain: *IMMA GET OUTTA HERE!*
    Me: ...

  • @Fuzzel
    @Fuzzel 3 года назад +88

    If you would include * into the constraint of allowed symbols you could probably optimize the generation of numbers through multiplication to make it smaller and get less of repeating +!![]

    • @Tetra._0
      @Tetra._0 3 года назад +4

      *You can easily generate large numbers by converting small ones and concatenating them*
      *For example, if i want to create the number 2147483647, this is what i will do :*
      _(+(_ // The "+" transforms the content between these parentheses in the form of a string into a number
      _(+!![]+!![]+[])_ // for "2" as string
      _+_
      (+!![]) // for 1
      _+_
      _(+!![]+!![]+!![]+!![])_ // for 4
      _+_
      _(+!![]+!![]+!![]+!![]+!![]+!![]+!![])_ // for 7
      _+_
      _(+!![]+!![]+!![]+!![])_ // for 4
      _+_
      _(+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![])_ // for 8
      _+_
      _(+!![]+!![]+!![])_ // for 3
      _+_
      _(+!![]+!![]+!![]+!![]+!![]+!![])_ // for 6
      _+_
      _(+!![]+!![]+!![]+!![])_ // for 4
      _+_
      _(+!![]+!![]+!![]+!![]+!![]+!![]+!![])_ // for 7
      ))
      *or in its version without comments or carriage returns :*
      _(+((+!![]+!![]+[])+(+!![])+(+!![]+!![]+!![]+!![])+(+!![]+!![]+!![]+!![]+!![]+!![]+!![])+(+!![]+!![]+!![]+!![])+(+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![])+(+!![]+!![]+!![])+(+!![]+!![]+!![]+!![]+!![]+!![])+(+!![]+!![]+!![]+!![])+(+!![]+!![]+!![]+!![]+!![]+!![]+!![])))_
      *It's still quite repetitive, but much less than before*
      *You can also create numbers in scientific notation using the letter "e" from "false", for example :*
      _(+(_ // The "+" transforms the content between these parentheses in the form of a string into a number
      _(+!![])_ // for 1
      _+_
      _(![]+[])[_ // for "false"
      _+!![]+!![]+!![]+!![]_ // for index 4 of "false"
      _]_
      _+_
      _(+!![]+!![]+!![])_ // for 3
      _+_
      _(+![])_ // for 0
      _+_
      _(+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![])_ // for 8
      _))_
      *Will return the number 1e308*
      *in its version without comments or carriage returns :*
      _(+((+!![])+(![]+[])[+!![]+!![]+!![]+!![]]+(+!![]+!![]+!![])+(+![])+(+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![])))_

    • @imacds
      @imacds 2 года назад +1

      Is there a nontrivial way to generate '*'?

    • @spaghettiking653
      @spaghettiking653 2 года назад +2

      @@imacds Nontrivial? Probably, using eval or similar, but the trivial way would be to just type it in

    • @electricengine8407
      @electricengine8407 2 года назад +8

      He said / is in allowed chars so why would you not be able to do a/(1/b) its simple math

    • @Tiagocf2
      @Tiagocf2 2 года назад

      there's no need for it, you can just concatenate the numbers to make higher ones, like 1000 = '1' + '0' + '0' + '0'

  • @rocketlanterns
    @rocketlanterns 4 года назад +18

    Minor optimisation btw,
    If you were to pass the number say 109 into your number() function, would it not be fewer characters to do it as approximately
    +((one+[])+(zero+[])+(one+one+one+one+one+one+one+one+one+[]))
    i.e. parse each particular character of the number together, join them as a string, and then cast back into a number?

    • @rocketlanterns
      @rocketlanterns 4 года назад +2

      Also for getting capital c, why not do something along the line of
      number(12)['fromString("toString")'](number(13)))['fromString("upper")']()

    • @LowByteProductions
      @LowByteProductions  4 года назад +16

      That's a nice one! There are a lot of places for optimisation with this code - it was more like a speed run than anything else 😁

    • @LowByteProductions
      @LowByteProductions  4 года назад +17

      The method you need is called `toUpperCase` which unfortunately contains a capital C itself

  • @tiileaf
    @tiileaf Год назад

    You madman! This was so excellent!!

  • @zb9458
    @zb9458 2 года назад

    This is legendary, thanks for posting this!!

  • @ab.3800
    @ab.3800 2 года назад +6

    14:18 - I just finished writing my own version of this compiler in C, no file handling yet but have a working hello world. I plan on posting it on GitHub when it’s finished if you’re interested in it.
    I knew about some of this JS weirdness and this video taught me more about it and inspired me to write my program. Thank you for this video lol

  • @GIRGHGH
    @GIRGHGH 2 года назад +21

    As someone who's not done much with code, this is really interesting and helpful in understanding better how all this runs. When functions are left as just ambiguous words it's hard to tell what's even really going on.

    • @Dominik356
      @Dominik356 2 года назад +8

      As someone with some experience I would say this is about the worst example to learn about coding. Like this has nothing to do how computers work and just showcases how ridiculous javascripts policy of 'nothing causes errors; anything goes' can get.

    • @GIRGHGH
      @GIRGHGH 2 года назад +1

      @@Dominik356 I'm in no way at all taking any of this as a _way_ to code, ya goof

    • @GIRGHGH
      @GIRGHGH 2 года назад +1

      @the demons No, it's how I represent italicizing when all that youtube has is bolding, as I said I have not done much programming, I've written like, one line from a tutorial. Why ya just assuming stuff? Someone bother ya to make you so spiteful for no reason? I don't even know what a regex is.

    • @CHROMIUMHEROmusic
      @CHROMIUMHEROmusic 2 года назад

      @@GIRGHGH _Just flying in to say that wrapping text in underscores italicizes them_ :)

    • @GIRGHGH
      @GIRGHGH 2 года назад

      @@CHROMIUMHEROmusic Very useful information, nobody's ever mentioned that before.

  • @M2dScientist
    @M2dScientist 3 года назад

    This is amazing! Thanks for sharing this :)

  • @DanteEhome
    @DanteEhome 2 года назад

    Omg. This is beyond interesting. I wish my college offered me more information about compiler.

  • @skeletonrowdie1768
    @skeletonrowdie1768 2 года назад +4

    this shit is crazy and I love that is made by "low level javascript'. Never was low level so misunderstood (by me at least).

  • @thetotallyawesomecuber3779
    @thetotallyawesomecuber3779 2 года назад +7

    you can also make the number function just
    const number = (n) => {
    return one.repeat(n) == "" ? zero : one.repeat(n);
    };

    • @AlexanderBraekevelt
      @AlexanderBraekevelt 2 года назад +1

      you could shorten it further to this:
      const number = n => n ? zero : one.repeat(n);

  • @jurijzahn8985
    @jurijzahn8985 2 года назад

    I have already read the jsf**k blog. But your video brings it to the next level 😁. I have learned a lot... Again 😁 Thank you!

  • @MichaelGriffin_
    @MichaelGriffin_ Год назад

    This is the best thing I've seen all week, thanks so much.

  • @stanleyyelnats3799
    @stanleyyelnats3799 2 года назад +17

    Hilarious video in a fantastic nerdy way 😂 After it I played around with it, and I think you can restrict the allowed characters even more:
    `=>`: We can use Object().constructor.constructor to get a function constructor.
    `\`: We can escape the `,` instead of the `\` to get the `C`. The `,` we can get by using `split` on a string.
    `-`: We can get the `p` the same way as the `d` by using the `toString` method.
    This will then only leave us with `({[+!]})`.

    • @vndx_
      @vndx_ 2 года назад +2

      You can do anything with `([+!])`, it does get pretty big tho, since the worst case scenario is a couple thousand character worth of code for a single one (when you gotta use fromCharCode)

    • @Tiagocf2
      @Tiagocf2 2 года назад +1

      you can get 'd' with the word undefined tho by calling a random index of an empty array
      ([])[1] = undefined

    • @Tiagocf2
      @Tiagocf2 2 года назад

      @@vndx_ lmao i have to try it

    • @iskamag
      @iskamag Год назад

      this is just brainfuck but worse
      it's 8 symbols too...

  • @nonetrix3066
    @nonetrix3066 2 года назад +3

    Time to compile my 200MB angular app to jsfuck and make it 700MB while taking a hour to update the dom

    • @LowByteProductions
      @LowByteProductions  2 года назад +5

      Still a better experience than visiting my banks website

  • @Inyourface3445
    @Inyourface3445 6 месяцев назад +2

    You could use the number base system for all letters (assuming JavaScript overflows into capital letters when the bace is greater then 36)

    • @kacperkonieczny7333
      @kacperkonieczny7333 2 месяца назад

      The toString function has a limit of 2 - 36 inclusive

  • @tsomic
    @tsomic Год назад +1

    Really great video!
    As optimization when requiring numbers > 9, you could split each digit, generate those and concat them all together as string.
    That would improve the additions necessary for a "23" from 23 times to 2 + 3 times

    • @dfp_01
      @dfp_01 Год назад

      I'm kind of surprised he didn't use the 1 and 0 to create binary representations, then use the binary representations to get the characters

  • @marekslazak1003
    @marekslazak1003 2 года назад +4

    I know i got recommended this. I've seen a video going as low as 6 characters and still kept JS turing-complete. Granted, there were no code examples, but a pretty nice explaination

  • @samuelgunter
    @samuelgunter 2 года назад +4

    JSFuck actually only needs 6 characters: []()!+

    • @LowByteProductions
      @LowByteProductions  2 года назад +6

      Indeed - but it's easier to explain if you use a few more

  • @lorenzrosenthal119
    @lorenzrosenthal119 2 года назад +2

    the type coersion module of the language interpreter is the thing Doom Guy was sent to fight on Mars.

  • @DragonSight_
    @DragonSight_ 2 года назад

    Cool stuff.
    Forturnately had put together some game engine DLL api implementation macro thingy.
    Can get a grasp onto it.

  • @angeldude101
    @angeldude101 2 года назад +6

    Probably the thing I understand the least about this video is why +[] casts to a strong rather than an array when [] on its own is an array. Why wouldn't casting to a string be done with +"" instead?

    • @TheGreatAtario
      @TheGreatAtario 2 года назад +4

      Because + operator is not defined for arrays

    • @angeldude101
      @angeldude101 2 года назад +1

      @@TheGreatAtario That's... I would say that's stupid, but it's honestly just par for the course when it comes to Javascript. True, + for concatenation is more common for strings than arrays, but if neither argument is a string, I would never expect + to give a string.

    • @halfsourlizard9319
      @halfsourlizard9319 Год назад

      Never ask a question beginning with 'Why' and including 'JavaScript'.

  • @notyourbusiness2672
    @notyourbusiness2672 2 года назад +11

    Sounds like a very interesting video. I'd be happy to watch it as soon as I'll find my magnifying glass.

    • @Duiker36
      @Duiker36 2 года назад

      If you can't read it, most operating systems come with accessibility features, including the ability to magnify a portion of the screen.

  • @ltxr9973
    @ltxr9973 Год назад

    1:00 I can instantly see a "professional" use-case for this but I wouldn't want to have anything to do with it

  • @El-Burrito
    @El-Burrito Год назад +1

    This is mind bending and hilarious, i love it

  • @B0mbshell_
    @B0mbshell_ 4 года назад +6

    Couldn't the Number toString function be exploited to gain access to every single letter? I don't know much about JS, but if you could convert your numbers to a base 36 number system, it should use every character up to z.

    • @LowByteProductions
      @LowByteProductions  4 года назад

      You can only get as far as lowercase p, since the first 10 characters are still just the digits 0-9. And then you still need a way to get the uppercase characters.

    • @rocketlanterns
      @rocketlanterns 4 года назад +4

      @@LowByteProductions Base64 encoding not be viable?

    • @p07a
      @p07a 3 года назад +1

      @@rocketlanterns Non-Browser environments might not have btoa()

    • @parzh
      @parzh 2 года назад

      @@LowByteProductions But then again, you can get character "m" from the Number constructor

  • @sebdoucet_fr
    @sebdoucet_fr 2 года назад +29

    You should ve use the binary operator to get your uppercase chars... just move them of 64

    • @spaghettiking653
      @spaghettiking653 2 года назад +1

      32 iirc, but huge idea

    • @liranpiade4499
      @liranpiade4499 2 года назад +2

      Honestly I was confused, I thought "if he can grab numbers from base 16, all he needs to get the whole alphabet is a higher number base!" (and there's already a number constructor)

    • @LowByteProductions
      @LowByteProductions  2 года назад +4

      The highest base you can get is 36. That gives you the lowercase letters, but you also need a few uppercase.

    • @LowByteProductions
      @LowByteProductions  2 года назад +1

      How would you then convert the number back to a character value?

    • @CraftIP
      @CraftIP 2 года назад

      @@LowByteProductions in C++ an integer converts to the respective character with that integer as ascii value if casted to char iirc, no idea how you would do that in JS tho
      edit: I noticed some other people already pointed that out, and about C as well; guess we have no luck with this strategy, but the search isn't over

  • @uhrendoktor1645
    @uhrendoktor1645 Год назад

    This video is an absolute gem😂 I love it

  • @garymerfdudegui9452
    @garymerfdudegui9452 Год назад +1

    I need to send some code like this to my old code class teacher

  • @KeinNiemand
    @KeinNiemand 2 года назад +4

    Perfect way to obfuscate javascript code

    • @dimitralex1892
      @dimitralex1892 2 года назад

      yeah and its used in the wild. the big problem is most people dont understand that obfuscation != security... in general there is no use for obfuscation in real life, because replacing one string which is interpreted with another string which is interpreted (in this case even the same way) doesnt make your code more secure or unreadable...

  • @liamgw9208
    @liamgw9208 3 года назад +3

    20:49 wait JS has pointers?

  • @Jason-wm5qe
    @Jason-wm5qe 2 года назад +1

    This is epic! Great video

  • @astrahcat1212
    @astrahcat1212 Год назад +2

    I used it in the Web 1.0 days with PHP and MySQL and I never touched Javascript again until this day because the language was so insanely annoying to deal with. PHP was too though.
    C# when I was learning confused me about when you do object = object it's a reference, while a = b if it's a variable rather than an object sets a to b.

  • @mariusschaer3415
    @mariusschaer3415 5 лет назад +6

    Couldn't you just get capital C using base64?

    • @LowByteProductions
      @LowByteProductions  5 лет назад +1

      Not in way that works in the browser and node. In the browser you can use atob() but in node you'd need Buffer.from(s).toString('base64')

    • @mariusschaer3415
      @mariusschaer3415 5 лет назад

      @@LowByteProductions Oh yeah, my bad. I assumed that toString would take any base > 2. But it only goes up to 36.

    • @LowByteProductions
      @LowByteProductions  5 лет назад +3

      Indeed - and I somehow only realised during the making of this video that 36 = ten digits + 26 characters, and not some arbitrary limit.

  • @xwashere
    @xwashere 3 года назад +6

    somebody at my school harassed me to make them a website and i gave them a mess of this kind of crap and they never spoke to me again
    (and i got a free 20 dollars)

  • @HiltownJoe
    @HiltownJoe 2 года назад +2

    Ohh god! This is so cursed, and I can not decide if I hate it or love it. I never coded JS before, and I hope that if I ever have to write a simple "hello world" in js, I remember this. Actually if I ever go back to UNI to finish my degree, I probably will take a JS course just to give a TA the most cursed homework he ever got.

  • @json_bourne3812
    @json_bourne3812 2 года назад

    Now I want to see a version of this but heavily typed!

  • @burnin8orable
    @burnin8orable 4 года назад +6

    I wish it would just throw a type exception.

  • @rakshiths.n9680
    @rakshiths.n9680 4 года назад +4

    Plz increase the font size...

  • @Ganerrr
    @Ganerrr Год назад

    Gödel's constructible javascript universe

  • @JanneWolterbeek
    @JanneWolterbeek 2 года назад +2

    This is very interesting and even entertaining. I’ve always hacked myself through my career with bits of jQuery here and there and not too much vanilla JS. I am a designer mostly, a coder secondly. I was wondering, how long are you writing/learning JS? I wonder if I should push myself more to get to your level. Pondering to specialize more and I think there’s more work for coders than designers at the moment…

    • @quatricise
      @quatricise 2 года назад

      I think you'll never need to be able to write crazy shit like this, if you want higher chances to get a job as a coder, i suggest looking into frameworks like React and Angular, since these are used by Facebook and google respectively, it's difficult to find any company that codes in vanilla JS
      There's a channel called Fireship that has a lot of videos about coding, frameworks and how to land job interviews and stuff.

  • @xMSaccountx
    @xMSaccountx Год назад +2

    I am still amazed to this day how a single being can torture himself with js syntax ,dealing with this language even for an hour gives me nervous breakdown

  • @hansgerber8654
    @hansgerber8654 2 года назад +8

    I always find it funny how often other scripting languages especially PHP get away with this without getting called out as much ... people love to hate JS especially

    • @reiuji_utsuho
      @reiuji_utsuho 2 года назад +5

      That hasn't been my experience at all. There's plenty of criticism of PHP out there. Some people go as far as calling it 'a language in which every feature is broken in some way'

    • @valoeghese
      @valoeghese 2 года назад

      mysql *real* escape string

  • @n1gthdreams
    @n1gthdreams 4 года назад +1

    ok this is actually really impressive !

  • @santiagocalvo
    @santiagocalvo Год назад

    This is genius, you got yourself a new subscriber!

  • @tedchirvasiu
    @tedchirvasiu 2 года назад +3

    12:08 - If you're allowed to use backslashes I guess you could just do map['\\'] = '\\', right?

    • @rz2374
      @rz2374 2 года назад

      No, he needs to get it in a string form so it can be passed into the function constructor. Thats what all that other stuff is for, it is basically saying quotes inside of quotes.

  • @JohnNecirRebellion
    @JohnNecirRebellion 4 года назад +4

    Who dislikes this video?

  • @natefinkemusic
    @natefinkemusic Год назад

    The glow effect on the text makes me feel like I have fuzz in my eyes

  • @williamdrum9899
    @williamdrum9899 Год назад +1

    Video: "a" is not a number and can't be sensibly transformed into a number
    0x61: "Am I a joke to you?"

    • @kacperkonieczny7333
      @kacperkonieczny7333 2 месяца назад

      I am gonna be pedantic and correct you that it should be 0x97 or atleast 0x65

    • @williamdrum9899
      @williamdrum9899 2 месяца назад

      @@kacperkonieczny7333 No, those are the base ten values. Drop the 0x and then they are correct. Ascii was designed so that switching between upper and lower case could be done by simply flipping a single bit

  • @abdelrahman5094
    @abdelrahman5094 4 года назад +3

    i wonder how many years do you spend to master JS in this spectacular way ?

    • @LowByteProductions
      @LowByteProductions  4 года назад +8

      Thanks - I've been writing JS professionally for around 5 years now

  • @FoxMonkey-xw5yf
    @FoxMonkey-xw5yf 5 лет назад +3

    Why? For the glory of Satan of course!

  • @sillydon3063
    @sillydon3063 2 года назад

    In the setup, appreciate the videos! Maybe a dumb question but is there a way to export content in mono in soft20?

  • @prkrr9936
    @prkrr9936 Год назад

    the shade thrown at C was so funny

  • @viniciuslambardozzi4358
    @viniciuslambardozzi4358 4 года назад +4

    Aaaaaand everything runs on this garbage nowadays.

  • @GearsDatapacks
    @GearsDatapacks Год назад

    This is soooo awesome!

  • @frankichiro
    @frankichiro Год назад +1

    I wonder if this helps with compression of JS code as it uses fewer characters, even if it uses them a lot more.

  • @dfp_01
    @dfp_01 Год назад +1

    Such an ironic video considering the name of your channel. Love it

  • @kipu44
    @kipu44 Год назад

    Why do we need to map backslash? It was in the base character set.
    On top of that it was used to generate it.
    Can someone explain?

  • @nicolaiveliki1409
    @nicolaiveliki1409 2 года назад

    Great Scott, this is heavy!

  • @jakewillsuffice6938
    @jakewillsuffice6938 2 года назад +1

    When your school project has a minimum amount of code lines required...

    • @chri-k
      @chri-k Год назад

      but the entire script is technically one line.
      Also why TF have a minimum number of code lines. I can see why you could have a target range of # lines for which you gain some extra points, but a hard minimum??

  • @SinisterSlay1
    @SinisterSlay1 2 года назад

    This is awesome. Why did youtube never recommend this?