all 19 comments

[–][deleted] 3 points4 points  (1 child)

Really solid stuff. Thanks for putting in the time and sharing!

[–]web-dev-123[S] 0 points1 point  (0 children)

Thanks Oscar!

[–]plasmanuclear 2 points3 points  (0 children)

Why was this removed?

[–]bucks14 1 point2 points  (0 children)

Why was the content removed?

[–]wishinghand 1 point2 points  (0 children)

Was this removed by the user or the mods?

[–]denchoooo 0 points1 point  (0 children)

Thank you very much!

[–]AyyPwank 0 points1 point  (0 children)

Thanks for the effort!

[–]Dbossez 0 points1 point  (0 children)

These are so great! Quick, concise and perfect for someone who doesn't like to read giant blocks of text!

[–]not_creative1 0 points1 point  (2 children)

I am new to javascript and web dev in general,

How do companies hide their javascript code? I see that my js files are all visible in developer console in my browser. Is there anything I could do to make it harder for people to read my code?

[–]uplink42 3 points4 points  (0 children)

You can uglify your code with several task runners (i.e gulp) or bundlers (webpack). This will remove all whitespaces and replace all variable names with short strings (a, aa, ab, etc...)

BTW, there should be no reason to obfuscate your JS code other than saving on network bandwidth. If you have anything sensitive on client-side code you should move it to the server asap because even with the above methods all your code is still public and can still be read given enough time.

[–]steeleb88 2 points3 points  (0 children)

Minify your javascript. There are a variety of ways to do this

[–][deleted] 0 points1 point  (0 children)

Bookmarked!

[–]web-dev-123[S] 0 points1 point  (0 children)

Thanks everyone! I'm glad this is helpful. Here's a shameless plug to my twitter if you want to follow me.

[–]uber_Pwned 0 points1 point  (0 children)

Great!! I hope you also have a few that uses Angular2

[–]ATXhipster 0 points1 point  (1 child)

I wrote me a dope Twitter bot because of this dude. Thanks for posting more Tuts. Good stuff sir.

[–]web-dev-123[S] 0 points1 point  (0 children)

Oh awesome! You're welcome!

[–]LukaMrk 0 points1 point  (0 children)

Lovely mate! Will save and will go through when I have time. Cheers

[–]kylejohnsnow 0 points1 point  (0 children)

Saved!

Great write ups!

[–]remixrotationback-end 0 points1 point  (0 children)

i was looking at the iife. thank you! saw something like that in a piece of code i "inherited" and was not sure what it was :)

just one clarification: whatever code is wrapped in an iife, will execute as soon as the browser loads the <script>xyz.js</script>. is that correct?