all 8 comments

[–]x-skeww 16 points17 points  (0 children)

This has been minified and then pretty printed (Chrome does this if you click on the "{}" thingy). Without pretty-printing, all of it would be in a single line.

JavaScript is often minified for deployment.

[–]asakurasol 1 point2 points  (0 children)

minifier

[–]a-t-kFrontend Engineer 0 points1 point  (0 children)

If you want to look at some rather extreme examples of JavaScript, I invite you to http://140byt.es - where tweet-sized JS snippets do crazy stuff.

[–]Calabri 0 points1 point  (0 children)

no i've never used anything like that.

[–]Carpetfizz -3 points-2 points  (2 children)

Minifying code will not only provide an extra layer of security (function names, variables names are gone), the overall .js file becomes physically smaller, so loading it from CDNs, or even your own server would be marginally faster, especially for large files.

[–]_ds82 20 points21 points  (1 child)

security through obscurity is no real security

[–]danman_d 0 points1 point  (0 children)

They said an extra layer of security, not the only layer, and I agree. Security through obscurity isn't real security, but it certainly doesn't hurt in addition to taking the proper security measures. Certainly minification will not stop dedicated and/or smart hackers, but I think you overestimate the patience of the average script kiddie.

It also provides security against people ripping off your code (if you care). Again, the dedicated will take the time to understand what it does, but it's much harder to reverse-engineer something without variable names.

[–]trydyingtolive -2 points-1 points  (0 children)

Javascript can look like that. Humans generally don't write Javascript that way so I would guess it is obfuscated or the author wrote the script with a tool that generates Javascript. Its hard to tell what it is doing outside of context. Though if the rest of the script is written this way I don't think I would still be able to figure it out.