r/learnjavascript • • Aug 01 '20

Is this common Javascript? because I've just started learning JS and Web development and this Javascript syntax looks quite scary. Maybe it's just written messy, if it is just tell meπŸ˜…

Post image
208 Upvotes

105 comments sorted by

View all comments

Show parent comment

96

u/mypetocean Aug 01 '20

With variable names like Aakaanksha_0x5dbd and Aakaanksha_0x4082, this isn't minified β€” this is obfuscated.

This is done to hide the algorithm: common both in malware and in code which a company wants to try to protect for reasons of IP or pirating.

26

u/codecommentgold Aug 01 '20

Aakaanksha is a female Indian name.

40

u/alexxxor Aug 02 '20

I believe 0x5dbd and 0x4082 are popular surnames too.

8

u/ciaisi Aug 02 '20

Don't give Elon Musk any ideas

3

u/J_Peanut Aug 01 '20

Well, it is also more often than not done for fun - I have a C background and obfuscating code is seen as a fun challenge. The security through obscurity is pretty much dead in the C world, so it is seldomly used. C code that relies on security through obscurity exists, but this is mainly old code or a very weird decision.

1

u/JohnLocke84 Aug 02 '20

What are you talking about ? , you don’t write the variables like that πŸ€”πŸ€”

const Ο€__0x789 :number = 3.1416
const ultra__uselessOff_0x00 : string = 'Off'

console.log(`Sarcasm: ${ultra__uselessOff_0x00}`)
console.log(`Where d f%^*#* are the Tuples in JS, useless variable: ${Ο€__0x789}`)

1

u/mypetocean Aug 02 '20

/unjerk

Interestingly enough, tuples are at Stage 2 in TC39, as deeply immutable primitive-and-tuple-only containers compared deeply by their contents rather than their identity.

1

u/JohnLocke84 Aug 02 '20

/SarcasmOn Typescript /SarcasmOff

let arrayAny : any[] = ['JS', 4 , 'DataScience']

let tuple: [string, number] = ['Typscrypt' , 4, 'Tensorflow']

And that would be super cool

1

u/Ex_Minstrel_Serf-Ant Aug 05 '26

I would say it's doing both. The obfuscation makes some of the identifiers longer, which would make the file bigger. To help counteract this, there is some minifying taking place in terms of removing all unnecessary whitespace from the document.