2

I am learning from stackoverflow and getting lot of solutions. When I study it I found that .js file has no structured like :

function MSIsPlayback()
{
    try
    {
        return parent&&parent.WebPlayer
    }
    catch(d)
    {
        return!1
    }
} 

but they wrote this in one line like ,

use strict';window.StackExchange={};function MSIsPlayback(){try{return parent&&parent.WebPlayer}catch(d){return!1}}if(!MSIsPlayback()&&top!=self)throw top.location.replace(document.location),$(function()$("head").add("body").remove()}),alert("For security reasons, framing is not allowed; click OK to remove the frames."),Error();

why?

Is programmer wrote it? or any software converted it in this pattern like after compilation? if they wrong then how then debug it?

please help thanks

Lee Taylor
  • 7,761
  • 16
  • 33
  • 49
shailendra
  • 205
  • 1
  • 8
  • 21

2 Answers2

0

that is minified js file. typically, you should minify your js file when you release that, in order to reduce load time.

you can fined uncompressed jquery source code here

yshrsmz
  • 1,179
  • 2
  • 15
  • 33
  • can you tell me how to minified js file and how to convert reverse in – shailendra Feb 01 '14 at 03:03
  • you can use uglifyjs, closure compiler, or YUI compressor to minify javascript file. and basically, you cannot fully unminify minified js file, since minifying process basically change variable's name to reduce file size. but you can reformat code by using [jsbeautifier]( http://jsbeautifier.org/) or chrome developer tool(click source tab, chose js file you want, then click `{}` icon at the left) – yshrsmz Feb 01 '14 at 03:05
0

This kind of doing is called as minifying of code, This process will be done once the code is fully tested and ready for the production. This process involves removal of unnecessary spaces, and giving a shorter variable, function name etc..

The main reason for minifying the code is to improve the loading time of a website.

Rajaprabhu Aravindasamy
  • 66,513
  • 17
  • 101
  • 130