Skip to main content
InterviewHubPRO
Section Overview
Q272

Question 272 of 536

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

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

Why do you need Obfuscation

mid LevelCode ExamplejavascriptES6+ Modern Syntax

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);}