title: What measuring unit is used for file sizes in javascript?
body: <p>am trying to validate file size on the client side before uploading to server. However I think i need to calculate max-size in javascript.</p>
  
  <p>So how do i write <strong>4MB</strong> in javascript ?
  I would also want to know basically in what measuring unit is javascript calculated in terms of file size.</p>
  
  <p>below is my colde:</p>
  
  <pre><code>//Grab the file list
          var files   =   e.target.files;
          $.each(files,function(i,file){
  
          //check for the correct file extensiton
          var n   = file.name,
              s   = file.size
              t   = file.type;
          if(s &gt; 4MB){
  
              console.log("File is greater than 4MB");
  
     }
  }
  </code></pre>
  
  <p>Please help.Thank you.</p>