Formater JavaScript
Upiększaj i minifikuj JavaScript
Wcięcie:
Wejście
Wyjście
Sformatowany JavaScript pojawi się tutaj...
Przykłady
| Typ | JavaScript | Zastosuj |
|---|---|---|
| Formatuj | function greet(name){if(!name){return "Hello!"}return "Hello, "+name+"!"} | |
| Formatuj | const users=[{id:1,name:"Ann"},{id:2,name:"Bob"}];const names=users.map(u=>u.name).filter(Boolean); | |
| Formatuj | class Queue{constructor(){this.items=[]}push(x){this.items.push(x);return this}pop(){return this.items.shift()}get size(){return this.items.length}} | |
| Formatuj | async function load(url){try{const res=await fetch(url);if(!res.ok)throw new Error(res.status);return await res.json()}catch(e){console.error(e);return null}} | |
| Minifikuj | function add(a, b) { // sum two numbers return a + b; } | |
| Minifikuj | export const TAX = 0.23; export function gross(net) { return net * (1 + TAX); } |