Get started with js-beautify CDN
MIT licensed
Js-beautify: popular JS, JSON formatter for code readability.
Tags:- beautify
- beautifier
- formatter
- code-quality
Stable version
Copied!
How to start using js-beautify CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with js-beautify CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/js-beautify/1.15.1/beautify.min.js"></script>
</head>
<body>
<button id="formatCode">Format Code</button>
<script>
document.getElementById('formatCode').addEventListener('click', () => {
const code = `
function add(x, y) {
return x + y;
}
function multiply(x, y) {
return x * y;
}
const result = add(multiply(2, 3), 5);
console.log(result);
`;
const formattedCode = beautify(code, { format: 'jsx' });
console.log('Original Code:');
console.log(code);
console.log('Formatted Code:');
console.log(formattedCode);
document.body.innerHTML += `<pre>${formattedCode}</pre>`;
});
</script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
All versions
0.1.8
0.2.0
0.2.1
0.2.2
0.2.3
0.2.4
0.3.0
0.3.1
0.3.2
0.3.3
0.3.4
0.3.5
0.3.6
0.3.7
0.3.8
0.3.9
0.4.0
0.4.1
0.4.2
1.10.0
1.10.1
1.10.1-rc2
1.10.2
1.10.3
1.11.0
1.12.0
1.13.0
1.13.1
1.13.11
1.13.13
1.13.2
1.13.3
1.13.4
1.13.5
1.13.6
1.13.7
1.13.8
1.14.0
1.14.1
1.14.10
1.14.11
1.14.2
1.14.3
1.14.4
1.14.5
1.14.6
1.14.7
1.14.8
1.14.9
1.15.0
*** 1.15.1
1.2.0
1.3.0
1.3.1
1.3.2
1.3.3
1.3.4
1.4.0
1.4.1
1.4.2
1.5.1
1.5.10
1.5.2
1.5.3
1.5.4
1.5.5
1.5.6
1.5.7
1.5.8
1.5.9
1.6.0
1.6.1
1.6.10
1.6.11
1.6.12
1.6.14
1.6.2
1.6.3
1.6.4
1.6.5
1.6.6
1.6.7
1.6.8
1.6.9
1.7.1
1.7.2
1.7.3
1.7.4
1.7.5
1.8.0
1.8.0-rc10
1.8.0-rc11
1.8.0-rc12
1.8.0-rc13
1.8.0-rc14
1.8.0-rc2
1.8.0-rc3
1.8.0-rc4
1.8.0-rc5
1.8.0-rc6
1.8.0-rc7
1.8.0-rc8
1.8.0-rc9
1.8.1
1.8.10-beta1
1.8.10-beta2
1.8.10-beta3
1.8.10-beta4
1.8.10-beta5
1.8.10-beta6
1.8.3
1.8.3-rc1
1.8.3-rc2
1.8.3-rc3
1.8.4
1.8.5
1.8.6
1.8.7
1.8.8
1.8.9
1.9.0
1.9.0-beta1
1.9.0-beta2
1.9.0-beta3
1.9.0-beta4
1.9.0-beta5
1.9.1