kb to mb js
const units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
function niceBytes(x){
let l = 0, n = parseInt(x, 10) || 0;
while(n >= 1024 && ++l){
n = n/1024;
}
//include a decimal point and a tenths-place digit if presenting
//less than ten of KB or greater units
return(n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]);
}
Also in JavaScript:
- minimum number of swaps to sort an array javascript
- angular cors issue
- how to copy to clipboard in p5.js
- angular http error handling
- sort array with negative numbers
- Create a server which serves at port 3000 and with node.js command prompt
- axios cdn
- Node require module
- change array index position in javascript by up and down click
- discord.js start code
- riverSizes javascript
- javascript add input
- how to check if user is typing discord js
- javascript measure time function
- jquery on scroll
- install json server with yarn
- is a letter javascript
- js disable event listener
- javascript get age
- anchor link issue with fixed header css js
- javascript getcontext
- load +main.js with system.import
- diynamic time vue js
- axios js