InterviewHubPRO
Section Overview
Q272

Question 272 of 521

Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

52%
JavaScript Internals (521 Qs)•Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

Why do you need Obfuscation

Below are the few reasons for Obfuscation,

  1. The Code size will be reduced. So data transfers between server and client will be fast.
  2. It hides the business logic from outside world and protects the code from others
  3. Reverse engineering is highly difficult
  4. The download time will be reduced

Practical Code Example

javascript
// Obfuscation: Transforms source code into difficult-to-understand representations
// protecting proprietary IP against reverse engineering:

// Original:
function login(username, password) { return password === 'secret'; }

// Obfuscated representation:
// function _0x2a(_0x1b,_0x3c){return _0x3c===String.fromCharCode(115,101,99,114,101,116);}