Toolkit Bay

Javascript Formatter / Beautifier

Format Javascript/Typescript file for better readibility and consistent

See more formatter tools

Javascript Formatter / Beautifier / Prettier

What is Javascript ?

Javacript is interpreted programming language, which at the beginning, mostly used as the scripting language for Web pages. But since the appearance of nodejs, many non-browser environments can also use it (such as on server), thus it is becoming very popular language.

In short, Javascript add interactiveness and much more features to a website.

Note: javascript evolving faster than html and css, so we might saw many changes on the road.

Sample of Javascript Code :

var a = "hello";
var b = " world";
console.log(a+b);
attack = (arg) => {
  for (i=0;i<arg;i++) {
    console.log(i)
  }
}

For the example above, the javascript code is inside <script> blocks.

Why you need to format the Javascript ?

Formatted Javascript will be easier to read, especially by the programmer. Hence the debugging or collaboration process can be much faster.

We can see that most website use minified Javascript to save disk space and bandwidth. So the rule of thumb is for development we use formatted/pretty Javascript, and for production we use minified javascript.

Special Note

If your code still looks weird after formatted (from minified input), such as contain weird variable name, you might want to look at source maps. More detail in

https://developer.chrome.com/blog/devtools-tips-23/

This tool support typescript as well and we give options for multiple types of parser, feel free to check on the option section.

Category
formatter
Tags

About

Toolkit Bay or TKB is an online tools website providing free and easy to use tools to increase productivity.

If you have any inquiries or suggestions or issues, you can contact us on: contact@toolkitbay.com

Data & Privacy

We respect your data. Uploaded file/data/input will be automatically deleted. And the processed data will be deleted less than a day.

More detail on privacy here

Copyright © 2024 Toolkit Bay. All Rights Reserved