Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
<script>
let scoops = $state(1);
let flavours = $state(['Mint choc chip']);

let menu = ['Cookies and cream', 'Mint choc chip', 'Raspberry ripple'];

function join(flavours) {
if (flavours.length === 1) return flavours[0];
return `${flavours.slice(0, -1).join(', ')} and ${flavours[flavours.length - 1]}`;
}
</script>

<h2>Size</h2>

<label>
<input type="radio" bind:group={scoops} value={1} />
One scoop
</label>

<label>
<input type="radio" bind:group={scoops} value={2} />
Two scoops
</label>

<label>
<input type="radio" bind:group={scoops} value={3} />
Three scoops
</label>

<h2>Flavours</h2>

{#each menu as flavour}
<label>
<input type="checkbox" bind:group={flavours} value={flavour} />
{flavour}
</label>

Error compiling component

WebAssembly.instantiateStreaming(): value type opcode @+13
import 'svelte/internal/disclose-version';
import * as $ from 'svelte/internal/client';

var root_1 = $.template(`<label><input type="checkbox"> </label>`);
var root_2 = $.template(`<p>Please select at least one flavour</p>`);
var root_4 = $.template(`<p>Can't order more flavours than scoops!</p>`);
var root_5 = $.template(`<p> </p>`);
var root = $.template(`<h2>Size</h2> <label><input type="radio"> One scoop</label> <label><input type="radio"> Two scoops</label> <label><input type="radio"> Three scoops</label> <h2>Flavours</h2> <!> <!>`, 1);

export default function App($$anchor, $$props) {
$.push($$props, true);

const binding_group = [];
const binding_group_1 = [];
let scoops = $.state(1);
let flavours = $.state($.proxy(['Mint choc chip']));

let menu = [
'Cookies and cream',
'Mint choc chip',
'Raspberry ripple'
];

function join(flavours) {
if (flavours.length === 1) return flavours[0];
return `${flavours.slice(0, -1).join(', ')} and ${flavours[flavours.length - 1]}`;
}

var fragment = root();
var label = $.sibling($.first_child(fragment), 2);
var input = $.child(label);

$.remove_input_defaults(input);
input.value = null == (input.__value = 1) ? '' : 1;
$.next();
$.reset(label);
result = svelte.compile(source, {
generate: ,
});
/* Add a <style> tag to see the CSS output */
		
			
				
  • Root {
    • css: null
    • js: []
    • start: 328
    • end: 1006
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (14)
        • Text {...}
          • type: "Text"
          • start: 326
          • end: 328
          • raw: "\n\n"
          • data: "\n\n"
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 328
          • end: 341
          • name: "h2"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (1)
              • Text {...}
                • type: "Text"
                • start: 332
                • end: 336
                • raw: "Size"
                • data: "Size"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 341
          • end: 343
          • raw: " "
          • data: " "
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 343
          • end: 424
          • name: "label"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (3)
              • Text {...}
                • type: "Text"
                • start: 350
                • end: 352
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 352
                • end: 404
                • name: "input"
                • attributes: [...] (3)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 359
                    • end: 371
                    • name: "type"
                    • value: [...] (1)
                      • Text {...}
                        • start: 365
                        • end: 370
                        • type: "Text"
                        • raw: "radio"
                        • data: "radio"
                        }
                      ]
                    }
                  • BindDirective {...}
                    • start: 372
                    • end: 391
                    • type: "BindDirective"
                    • name: "group"
                    • expression: Identifier {...}
                      • type: "Identifier"
                      • start: 384
                      • end: 390
                      • loc: {...}
                        • start: {...}
                          • line: 16
                          • column: 33
                          }
                        • end: {...}
                          • line: 16
                          • column: 39
                          }
                        }
                      • name: "scoops"
                      }
                    • modifiers: []
                    }
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 392
                    • end: 401
                    • name: "value"
                    • value: ExpressionTag {...}
                      • type: "ExpressionTag"
                      • start: 398
                      • end: 401
                      • expression: Literal {...}
                        • type: "Literal"
                        • start: 399
                        • end: 400
                        • loc: {...}
                          • start: {...}
                            • line: 16
                            • column: 48
                            }
                          • end: {...}
                            • line: 16
                            • column: 49
                            }
                          }
                        • value: 1
                        • raw: "1"
                        }
                      }
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 404
                • end: 416
                • raw: " One scoop"
                • data: " One scoop"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 424
          • end: 426
          • raw: " "
          • data: " "
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 426
          • end: 508
          • name: "label"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (3)
              • Text {...}
                • type: "Text"
                • start: 433
                • end: 435
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 435
                • end: 487
                • name: "input"
                • attributes: [...] (3)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 442
                    • end: 454
                    • name: "type"
                    • value: [...] (1)
                      • Text {...}
                        • start: 448
                        • end: 453
                        • type: "Text"
                        • raw: "radio"
                        • data: "radio"
                        }
                      ]
                    }
                  • BindDirective {...}
                    • start: 455
                    • end: 474
                    • type: "BindDirective"
                    • name: "group"
                    • expression: Identifier {...}
                      • type: "Identifier"
                      • start: 467
                      • end: 473
                      • loc: {...}
                        • start: {...}
                          • line: 21
                          • column: 33
                          }
                        • end: {...}
                          • line: 21
                          • column: 39
                          }
                        }
                      • name: "scoops"
                      }
                    • modifiers: []
                    }
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 475
                    • end: 484
                    • name: "value"
                    • value: ExpressionTag {...}
                      • type: "ExpressionTag"
                      • start: 481
                      • end: 484
                      • expression: Literal {...}
                        • type: "Literal"
                        • start: 482
                        • end: 483
                        • loc: {...}
                          • start: {...}
                            • line: 21
                            • column: 48
                            }
                          • end: {...}
                            • line: 21
                            • column: 49
                            }
                          }
                        • value: 2
                        • raw: "2"
                        }
                      }
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 487
                • end: 500
                • raw: " Two scoops"
                • data: " Two scoops"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 508
          • end: 510
          • raw: " "
          • data: " "
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 510
          • end: 594
          • name: "label"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (3)
              • Text {...}
                • type: "Text"
                • start: 517
                • end: 519
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 519
                • end: 571
                • name: "input"
                • attributes: [...] (3)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 526
                    • end: 538
                    • name: "type"
                    • value: [...] (1)
                      • Text {...}
                        • start: 532
                        • end: 537
                        • type: "Text"
                        • raw: "radio"
                        • data: "radio"
                        }
                      ]
                    }
                  • BindDirective {...}
                    • start: 539
                    • end: 558
                    • type: "BindDirective"
                    • name: "group"
                    • expression: Identifier {...}
                      • type: "Identifier"
                      • start: 551
                      • end: 557
                      • loc: {...}
                        • start: {...}
                          • line: 26
                          • column: 33
                          }
                        • end: {...}
                          • line: 26
                          • column: 39
                          }
                        }
                      • name: "scoops"
                      }
                    • modifiers: []
                    }
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 559
                    • end: 568
                    • name: "value"
                    • value: ExpressionTag {...}
                      • type: "ExpressionTag"
                      • start: 565
                      • end: 568
                      • expression: Literal {...}
                        • type: "Literal"
                        • start: 566
                        • end: 567
                        • loc: {...}
                          • start: {...}
                            • line: 26
                            • column: 48
                            }
                          • end: {...}
                            • line: 26
                            • column: 49
                            }
                          }
                        • value: 3
                        • raw: "3"
                        }
                      }
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 571
                • end: 586
                • raw: " Three scoops"
                • data: " Three scoops"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 594
          • end: 596
          • raw: " "
          • data: " "
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 596
          • end: 613
          • name: "h2"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (1)
              • Text {...}
                • type: "Text"
                • start: 600
                • end: 608
                • raw: "Flavours"
                • data: "Flavours"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 613
          • end: 615
          • raw: " "
          • data: " "
          }
        • EachBlock {...}
          • type: "EachBlock"
          • start: 615
          • end: 743
          • expression: Identifier {...}
            • type: "Identifier"
            • start: 622
            • end: 626
            • loc: {...}
              • start: {...}
                • line: 32
                • column: 7
                }
              • end: {...}
                • line: 32
                • column: 11
                }
              }
            • name: "menu"
            }
          • body: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (3)
              • Text {...}
                • type: "Text"
                • start: 638
                • end: 640
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 640
                • end: 735
                • name: "label"
                • attributes: []
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (5)
                    • Text {...}
                      • type: "Text"
                      • start: 647
                      • end: 650
                      • raw: "\n\t\t"
                      • data: "\n\t\t"
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 650
                      • end: 713
                      • name: "input"
                      • attributes: [...] (3)
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 657
                          • end: 672
                          • name: "type"
                          • value: [...] (1)
                            • Text {...}
                              • start: 663
                              • end: 671
                              • type: "Text"
                              • raw: "checkbox"
                              • data: "checkbox"
                              }
                            ]
                          }
                        • BindDirective {...}
                          • start: 673
                          • end: 694
                          • type: "BindDirective"
                          • name: "group"
                          • expression: Identifier {...}
                            • type: "Identifier"
                            • start: 685
                            • end: 693
                            • loc: {...}
                              • start: {...}
                                • line: 34
                                • column: 37
                                }
                              • end: {...}
                                • line: 34
                                • column: 45
                                }
                              }
                            • name: "flavours"
                            }
                          • modifiers: []
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 695
                          • end: 710
                          • name: "value"
                          • value: ExpressionTag {...}
                            • type: "ExpressionTag"
                            • start: 701
                            • end: 710
                            • expression: Identifier {...}
                              • type: "Identifier"
                              • start: 702
                              • end: 709
                              • loc: {...}
                                • start: {...}
                                  • line: 34
                                  • column: 54
                                  }
                                • end: {...}
                                  • line: 34
                                  • column: 61
                                  }
                                }
                              • name: "flavour"
                              }
                            }
                          }
                        ]
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 713
                      • end: 716
                      • raw: " "
                      • data: " "
                      }
                    • ExpressionTag {...}
                      • type: "ExpressionTag"
                      • start: 716
                      • end: 725
                      • expression: Identifier {...}
                        • type: "Identifier"
                        • start: 717
                        • end: 724
                        • loc: {...}
                          • start: {...}
                            • line: 35
                            • column: 3
                            }
                          • end: {...}
                            • line: 35
                            • column: 10
                            }
                          }
                        • name: "flavour"
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 725
                      • end: 727
                      • raw: "\n\t"
                      • data: "\n\t"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 735
                • end: 736
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          • context: Identifier {...}
            • type: "Identifier"
            • name: "flavour"
            • start: 630
            • loc: {...}
              • start: {...}
                • line: 32
                • column: 15
                • character: 630
                }
              • end: {...}
                • line: 32
                • column: 22
                • character: 637
                }
              }
            • end: 637
            • typeAnnotation: undefined
            }
          • index: undefined
          • key: undefined
          }
        • Text {...}
          • type: "Text"
          • start: 743
          • end: 745
          • raw: " "
          • data: " "
          }
        • IfBlock {...}
          • type: "IfBlock"
          • elseif: false
          • start: 745
          • end: 1006
          • test: BinaryExpression {...}
            • type: "BinaryExpression"
            • start: 750
            • end: 771
            • loc: {...}
              • start: {...}
                • line: 39
                • column: 5
                }
              • end: {...}
                • line: 39
                • column: 26
                }
              }
            • left: MemberExpression {...}
              • type: "MemberExpression"
              • start: 750
              • end: 765
              • loc: {...}
                • start: {...}
                  • line: 39
                  • column: 5
                  }
                • end: {...}
                  • line: 39
                  • column: 20
                  }
                }
              • object: Identifier {...}
                • type: "Identifier"
                • start: 750
                • end: 758
                • loc: {...}
                  • start: {...}
                    • line: 39
                    • column: 5
                    }
                  • end: {...}
                    • line: 39
                    • column: 13
                    }
                  }
                • name: "flavours"
                }
              • property: Identifier {...}
                • type: "Identifier"
                • start: 759
                • end: 765
                • loc: {...}
                  • start: {...}
                    • line: 39
                    • column: 14
                    }
                  • end: {...}
                    • line: 39
                    • column: 20
                    }
                  }
                • name: "length"
                }
              • computed: false
              • optional: false
              }
            • operator: "==="
            • right: Literal {...}
              • type: "Literal"
              • start: 770
              • end: 771
              • loc: {...}
                • start: {...}
                  • line: 39
                  • column: 25
                  }
                • end: {...}
                  • line: 39
                  • column: 26
                  }
                }
              • value: 0
              • raw: "0"
              }
            }
          • consequent: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (3)
              • Text {...}
                • type: "Text"
                • start: 772
                • end: 774
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 774
                • end: 815
                • name: "p"
                • attributes: []
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (1)
                    • Text {...}
                      • type: "Text"
                      • start: 777
                      • end: 811
                      • raw: "Please select at least one flavour"
                      • data: "Please select at least one flavour"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 815
                • end: 816
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          • alternate: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (1)
              • IfBlock {...}
                • start: 816
                • end: 1006
                • type: "IfBlock"
                • elseif: true
                • test: BinaryExpression {...}
                  • type: "BinaryExpression"
                  • start: 826
                  • end: 850
                  • loc: {...}
                    • start: {...}
                      • line: 41
                      • column: 10
                      }
                    • end: {...}
                      • line: 41
                      • column: 34
                      }
                    }
                  • left: MemberExpression {...}
                    • type: "MemberExpression"
                    • start: 826
                    • end: 841
                    • loc: {...}
                      • start: {...}
                        • line: 41
                        • column: 10
                        }
                      • end: {...}
                        • line: 41
                        • column: 25
                        }
                      }
                    • object: Identifier {...}
                      • type: "Identifier"
                      • start: 826
                      • end: 834
                      • loc: {...}
                        • start: {...}
                          • line: 41
                          • column: 10
                          }
                        • end: {...}
                          • line: 41
                          • column: 18
                          }
                        }
                      • name: "flavours"
                      }
                    • property: Identifier {...}
                      • type: "Identifier"
                      • start: 835
                      • end: 841
                      • loc: {...}
                        • start: {...}
                          • line: 41
                          • column: 19
                          }
                        • end: {...}
                          • line: 41
                          • column: 25
                          }
                        }
                      • name: "length"
                      }
                    • computed: false
                    • optional: false
                    }
                  • operator: ">"
                  • right: Identifier {...}
                    • type: "Identifier"
                    • start: 844
                    • end: 850
                    • loc: {...}
                      • start: {...}
                        • line: 41
                        • column: 28
                        }
                      • end: {...}
                        • line: 41
                        • column: 34
                        }
                      }
                    • name: "scoops"
                    }
                  }
                • consequent: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (3)
                    • Text {...}
                      • type: "Text"
                      • start: 851
                      • end: 853
                      • raw: "\n\t"
                      • data: "\n\t"
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 853
                      • end: 898
                      • name: "p"
                      • attributes: []
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: [...] (1)
                          • Text {...}
                            • type: "Text"
                            • start: 856
                            • end: 894
                            • raw: "Can't order more flavours than scoops!"
                            • data: "Can't order more flavours than scoops!"
                            }
                          ]
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 898
                      • end: 899
                      • raw: "\n"
                      • data: "\n"
                      }
                    ]
                  }
                • alternate: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (3)
                    • Text {...}
                      • type: "Text"
                      • start: 906
                      • end: 908
                      • raw: "\n\t"
                      • data: "\n\t"
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 908
                      • end: 1000
                      • name: "p"
                      • attributes: []
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: [...] (7)
                          • Text {...}
                            • type: "Text"
                            • start: 911
                            • end: 926
                            • raw: "You ordered "
                            • data: "You ordered "
                            }
                          • ExpressionTag {...}
                            • type: "ExpressionTag"
                            • start: 926
                            • end: 934
                            • expression: Identifier {...}
                              • type: "Identifier"
                              • start: 927
                              • end: 933
                              • loc: {...}
                                • start: {...}
                                  • line: 45
                                  • column: 15
                                  }
                                • end: {...}
                                  • line: 45
                                  • column: 21
                                  }
                                }
                              • name: "scoops"
                              }
                            }
                          • Text {...}
                            • type: "Text"
                            • start: 934
                            • end: 937
                            • raw: "\n\t\t"
                            • data: "\n\t\t"
                            }
                          • ExpressionTag {...}
                            • type: "ExpressionTag"
                            • start: 937
                            • end: 972
                            • expression: ConditionalExpression {...}
                              • type: "ConditionalExpression"
                              • start: 938
                              • end: 971
                              • loc: {...}
                                • start: {...}
                                  • line: 46
                                  • column: 3
                                  }
                                • end: {...}
                                  • line: 46
                                  • column: 36
                                  }
                                }
                              • test: BinaryExpression {...}
                                • type: "BinaryExpression"
                                • start: 938
                                • end: 950
                                • loc: {...}
                                  • start: {...}
                                    • line: 46
                                    • column: 3
                                    }
                                  • end: {...}
                                    • line: 46
                                    • column: 15
                                    }
                                  }
                                • left: Identifier {...}
                                  • type: "Identifier"
                                  • start: 938
                                  • end: 944
                                  • loc: {...}
                                    • start: {...}
                                      • line: 46
                                      • column: 3
                                      }
                                    • end: {...}
                                      • line: 46
                                      • column: 9
                                      }
                                    }
                                  • name: "scoops"
                                  }
                                • operator: "==="
                                • right: Literal {...}
                                  • type: "Literal"
                                  • start: 949
                                  • end: 950
                                  • loc: {...}
                                    • start: {...}
                                      • line: 46
                                      • column: 14
                                      }
                                    • end: {...}
                                      • line: 46
                                      • column: 15
                                      }
                                    }
                                  • value: 1
                                  • raw: "1"
                                  }
                                }
                              • consequent: Literal {...}
                                • type: "Literal"
                                • start: 953
                                • end: 960
                                • loc: {...}
                                  • start: {...}
                                    • line: 46
                                    • column: 18
                                    }
                                  • end: {...}
                                    • line: 46
                                    • column: 25
                                    }
                                  }
                                • value: "scoop"
                                • raw: "'scoop'"
                                }
                              • alternate: Literal {...}
                                • type: "Literal"
                                • start: 963
                                • end: 971
                                • loc: {...}
                                  • start: {...}
                                    • line: 46
                                    • column: 28
                                    }
                                  • end: {...}
                                    • line: 46
                                    • column: 36
                                    }
                                  }
                                • value: "scoops"
                                • raw: "'scoops'"
                                }
                              }
                            }
                          • Text {...}
                            • type: "Text"
                            • start: 972
                            • end: 978
                            • raw: "\n\t\tof "
                            • data: "\n\t\tof "
                            }
                          • ExpressionTag {...}
                            • type: "ExpressionTag"
                            • start: 978
                            • end: 994
                            • expression: CallExpression {...}
                              • type: "CallExpression"
                              • start: 979
                              • end: 993
                              • loc: {...}
                                • start: {...}
                                  • line: 47
                                  • column: 6
                                  }
                                • end: {...}
                                  • line: 47
                                  • column: 20
                                  }
                                }
                              • callee: Identifier {...}
                                • type: "Identifier"
                                • start: 979
                                • end: 983
                                • loc: {...}
                                  • start: {...}
                                    • line: 47
                                    • column: 6
                                    }
                                  • end: {...}
                                    • line: 47
                                    • column: 10
                                    }
                                  }
                                • name: "join"
                                }
                              • arguments: [...] (1)
                                • Identifier {...}
                                  • type: "Identifier"
                                  • start: 984
                                  • end: 992
                                  • loc: {...}
                                    • start: {...}
                                      • line: 47
                                      • column: 11
                                      }
                                    • end: {...}
                                      • line: 47
                                      • column: 19
                                      }
                                    }
                                  • name: "flavours"
                                  }
                                ]
                              • optional: false
                              }
                            }
                          • Text {...}
                            • type: "Text"
                            • start: 994
                            • end: 996
                            • raw: "\n\t"
                            • data: "\n\t"
                            }
                          ]
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 1000
                      • end: 1001
                      • raw: "\n"
                      • data: "\n"
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 326
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 317
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 11
            • column: 0
            }
          }
        • body: [...] (4)
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 10
            • end: 33
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 1
                }
              • end: {...}
                • line: 2
                • column: 24
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 14
                • end: 32
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 5
                    }
                  • end: {...}
                    • line: 2
                    • column: 23
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 14
                  • end: 20
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 5
                      }
                    • end: {...}
                      • line: 2
                      • column: 11
                      }
                    }
                  • name: "scoops"
                  }
                • init: CallExpression {...}
                  • type: "CallExpression"
                  • start: 23
                  • end: 32
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 14
                      }
                    • end: {...}
                      • line: 2
                      • column: 23
                      }
                    }
                  • callee: Identifier {...}
                    • type: "Identifier"
                    • start: 23
                    • end: 29
                    • loc: {...}
                      • start: {...}
                        • line: 2
                        • column: 14
                        }
                      • end: {...}
                        • line: 2
                        • column: 20
                        }
                      }
                    • name: "$state"
                    }
                  • arguments: [...] (1)
                    • Literal {...}
                      • type: "Literal"
                      • start: 30
                      • end: 31
                      • loc: {...}
                        • start: {...}
                          • line: 2
                          • column: 21
                          }
                        • end: {...}
                          • line: 2
                          • column: 22
                          }
                        }
                      • value: 1
                      • raw: "1"
                      }
                    ]
                  • optional: false
                  }
                }
              ]
            • kind: "let"
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 35
            • end: 77
            • loc: {...}
              • start: {...}
                • line: 3
                • column: 1
                }
              • end: {...}
                • line: 3
                • column: 43
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 39
                • end: 76
                • loc: {...}
                  • start: {...}
                    • line: 3
                    • column: 5
                    }
                  • end: {...}
                    • line: 3
                    • column: 42
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 39
                  • end: 47
                  • loc: {...}
                    • start: {...}
                      • line: 3
                      • column: 5
                      }
                    • end: {...}
                      • line: 3
                      • column: 13
                      }
                    }
                  • name: "flavours"
                  }
                • init: CallExpression {...}
                  • type: "CallExpression"
                  • start: 50
                  • end: 76
                  • loc: {...}
                    • start: {...}
                      • line: 3
                      • column: 16
                      }
                    • end: {...}
                      • line: 3
                      • column: 42
                      }
                    }
                  • callee: Identifier {...}
                    • type: "Identifier"
                    • start: 50
                    • end: 56
                    • loc: {...}
                      • start: {...}
                        • line: 3
                        • column: 16
                        }
                      • end: {...}
                        • line: 3
                        • column: 22
                        }
                      }
                    • name: "$state"
                    }
                  • arguments: [...] (1)
                    • ArrayExpression {...}
                      • type: "ArrayExpression"
                      • start: 57
                      • end: 75
                      • loc: {...}
                        • start: {...}
                          • line: 3
                          • column: 23
                          }
                        • end: {...}
                          • line: 3
                          • column: 41
                          }
                        }
                      • elements: [...] (1)
                        • Literal {...}
                          • type: "Literal"
                          • start: 58
                          • end: 74
                          • loc: {...}
                            • start: {...}
                              • line: 3
                              • column: 24
                              }
                            • end: {...}
                              • line: 3
                              • column: 40
                              }
                            }
                          • value: "Mint choc chip"
                          • raw: "'Mint choc chip'"
                          }
                        ]
                      }
                    ]
                  • optional: false
                  }
                }
              ]
            • kind: "let"
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 80
            • end: 151
            • loc: {...}
              • start: {...}
                • line: 5
                • column: 1
                }
              • end: {...}
                • line: 5
                • column: 72
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 84
                • end: 150
                • loc: {...}
                  • start: {...}
                    • line: 5
                    • column: 5
                    }
                  • end: {...}
                    • line: 5
                    • column: 71
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 84
                  • end: 88
                  • loc: {...}
                    • start: {...}
                      • line: 5
                      • column: 5
                      }
                    • end: {...}
                      • line: 5
                      • column: 9
                      }
                    }
                  • name: "menu"
                  }
                • init: ArrayExpression {...}
                  • type: "ArrayExpression"
                  • start: 91
                  • end: 150
                  • loc: {...}
                    • start: {...}
                      • line: 5
                      • column: 12
                      }
                    • end: {...}
                      • line: 5
                      • column: 71
                      }
                    }
                  • elements: [...] (3)
                    • Literal {...}
                      • type: "Literal"
                      • start: 92
                      • end: 111
                      • loc: {...}
                        • start: {...}
                          • line: 5
                          • column: 13
                          }
                        • end: {...}
                          • line: 5
                          • column: 32
                          }
                        }
                      • value: "Cookies and cream"
                      • raw: "'Cookies and cream'"
                      }
                    • Literal {...}
                      • type: "Literal"
                      • start: 113
                      • end: 129
                      • loc: {...}
                        • start: {...}
                          • line: 5
                          • column: 34
                          }
                        • end: {...}
                          • line: 5
                          • column: 50
                          }
                        }
                      • value: "Mint choc chip"
                      • raw: "'Mint choc chip'"
                      }
                    • Literal {...}
                      • type: "Literal"
                      • start: 131
                      • end: 149
                      • loc: {...}
                        • start: {...}
                          • line: 5
                          • column: 52
                          }
                        • end: {...}
                          • line: 5
                          • column: 70
                          }
                        }
                      • value: "Raspberry ripple"
                      • raw: "'Raspberry ripple'"
                      }
                    ]
                  }
                }
              ]
            • kind: "let"
            }
          • FunctionDeclaration {...}
            • type: "FunctionDeclaration"
            • start: 154
            • end: 316
            • loc: {...}
              • start: {...}
                • line: 7
                • column: 1
                }
              • end: {...}
                • line: 10
                • column: 2
                }
              }
            • id: Identifier {...}
              • type: "Identifier"
              • start: 163
              • end: 167
              • loc: {...}
                • start: {...}
                  • line: 7
                  • column: 10
                  }
                • end: {...}
                  • line: 7
                  • column: 14
                  }
                }
              • name: "join"
              }
            • expression: false
            • generator: false
            • async: false
            • params: [...] (1)
              • Identifier {...}
                • type: "Identifier"
                • start: 168
                • end: 176
                • loc: {...}
                  • start: {...}
                    • line: 7
                    • column: 15
                    }
                  • end: {...}
                    • line: 7
                    • column: 23
                    }
                  }
                • name: "flavours"
                }
              ]
            • body: BlockStatement {...}
              • type: "BlockStatement"
              • start: 178
              • end: 316
              • loc: {...}
                • start: {...}
                  • line: 7
                  • column: 25
                  }
                • end: {...}
                  • line: 10
                  • column: 2
                  }
                }
              • body: [...] (2)
                • IfStatement {...}
                  • type: "IfStatement"
                  • start: 182
                  • end: 228
                  • loc: {...}
                    • start: {...}
                      • line: 8
                      • column: 2
                      }
                    • end: {...}
                      • line: 8
                      • column: 48
                      }
                    }
                  • test: BinaryExpression {...}
                    • type: "BinaryExpression"
                    • start: 186
                    • end: 207
                    • loc: {...}
                      • start: {...}
                        • line: 8
                        • column: 6
                        }
                      • end: {...}
                        • line: 8
                        • column: 27
                        }
                      }
                    • left: MemberExpression {...}
                      • type: "MemberExpression"
                      • start: 186
                      • end: 201
                      • loc: {...}
                        • start: {...}
                          • line: 8
                          • column: 6
                          }
                        • end: {...}
                          • line: 8
                          • column: 21
                          }
                        }
                      • object: Identifier {...}
                        • type: "Identifier"
                        • start: 186
                        • end: 194
                        • loc: {...}
                          • start: {...}
                            • line: 8
                            • column: 6
                            }
                          • end: {...}
                            • line: 8
                            • column: 14
                            }
                          }
                        • name: "flavours"
                        }
                      • property: Identifier {...}
                        • type: "Identifier"
                        • start: 195
                        • end: 201
                        • loc: {...}
                          • start: {...}
                            • line: 8
                            • column: 15
                            }
                          • end: {...}
                            • line: 8
                            • column: 21
                            }
                          }
                        • name: "length"
                        }
                      • computed: false
                      • optional: false
                      }
                    • operator: "==="
                    • right: Literal {...}
                      • type: "Literal"
                      • start: 206
                      • end: 207
                      • loc: {...}
                        • start: {...}
                          • line: 8
                          • column: 26
                          }
                        • end: {...}
                          • line: 8
                          • column: 27
                          }
                        }
                      • value: 1
                      • raw: "1"
                      }
                    }
                  • consequent: ReturnStatement {...}
                    • type: "ReturnStatement"
                    • start: 209
                    • end: 228
                    • loc: {...}
                      • start: {...}
                        • line: 8
                        • column: 29
                        }
                      • end: {...}
                        • line: 8
                        • column: 48
                        }
                      }
                    • argument: MemberExpression {...}
                      • type: "MemberExpression"
                      • start: 216
                      • end: 227
                      • loc: {...}
                        • start: {...}
                          • line: 8
                          • column: 36
                          }
                        • end: {...}
                          • line: 8
                          • column: 47
                          }
                        }
                      • object: Identifier {...}
                        • type: "Identifier"
                        • start: 216
                        • end: 224
                        • loc: {...}
                          • start: {...}
                            • line: 8
                            • column: 36
                            }
                          • end: {...}
                            • line: 8
                            • column: 44
                            }
                          }
                        • name: "flavours"
                        }
                      • property: Literal {...}
                        • type: "Literal"
                        • start: 225
                        • end: 226
                        • loc: {...}
                          • start: {...}
                            • line: 8
                            • column: 45
                            }
                          • end: {...}
                            • line: 8
                            • column: 46
                            }
                          }
                        • value: 0
                        • raw: "0"
                        }
                      • computed: true
                      • optional: false
                      }
                    }
                  • alternate: null
                  }
                • ReturnStatement {...}
                  • type: "ReturnStatement"
                  • start: 231
                  • end: 313
                  • loc: {...}
                    • start: {...}
                      • line: 9
                      • column: 2
                      }
                    • end: {...}
                      • line: 9
                      • column: 84
                      }
                    }
                  • argument: TemplateLiteral {...}
                    • type: "TemplateLiteral"
                    • start: 238
                    • end: 312
                    • loc: {...}
                      • start: {...}
                        • line: 9
                        • column: 9
                        }
                      • end: {...}
                        • line: 9
                        • column: 83
                        }
                      }
                    • expressions: [...] (2)
                      • CallExpression {...}
                        • type: "CallExpression"
                        • start: 241
                        • end: 273
                        • loc: {...}
                          • start: {...}
                            • line: 9
                            • column: 12
                            }
                          • end: {...}
                            • line: 9
                            • column: 44
                            }
                          }
                        • callee: MemberExpression {...}
                          • type: "MemberExpression"
                          • start: 241
                          • end: 267
                          • loc: {...}
                            • start: {...}
                              • line: 9
                              • column: 12
                              }
                            • end: {...}
                              • line: 9
                              • column: 38
                              }
                            }
                          • object: CallExpression {...}
                            • type: "CallExpression"
                            • start: 241
                            • end: 262
                            • loc: {...}
                              • start: {...}
                                • line: 9
                                • column: 12
                                }
                              • end: {...}
                                • line: 9
                                • column: 33
                                }
                              }
                            • callee: MemberExpression {...}
                              • type: "MemberExpression"
                              • start: 241
                              • end: 255
                              • loc: {...}
                                • start: {...}
                                  • line: 9
                                  • column: 12
                                  }
                                • end: {...}
                                  • line: 9
                                  • column: 26
                                  }
                                }
                              • object: Identifier {...}
                                • type: "Identifier"
                                • start: 241
                                • end: 249
                                • loc: {...}
                                  • start: {...}
                                    • line: 9
                                    • column: 12
                                    }
                                  • end: {...}
                                    • line: 9
                                    • column: 20
                                    }
                                  }
                                • name: "flavours"
                                }
                              • property: Identifier {...}
                                • type: "Identifier"
                                • start: 250
                                • end: 255
                                • loc: {...}
                                  • start: {...}
                                    • line: 9
                                    • column: 21
                                    }
                                  • end: {...}
                                    • line: 9
                                    • column: 26
                                    }
                                  }
                                • name: "slice"
                                }
                              • computed: false
                              • optional: false
                              }
                            • arguments: [...] (2)
                              • Literal {...}
                                • type: "Literal"
                                • start: 256
                                • end: 257
                                • loc: {...}
                                  • start: {...}
                                    • line: 9
                                    • column: 27
                                    }
                                  • end: {...}
                                    • line: 9
                                    • column: 28
                                    }
                                  }
                                • value: 0
                                • raw: "0"
                                }
                              • UnaryExpression {...}
                                • type: "UnaryExpression"
                                • start: 259
                                • end: 261
                                • loc: {...}
                                  • start: {...}
                                    • line: 9
                                    • column: 30
                                    }
                                  • end: {...}
                                    • line: 9
                                    • column: 32
                                    }
                                  }
                                • operator: "-"
                                • prefix: true
                                • argument: Literal {...}
                                  • type: "Literal"
                                  • start: 260
                                  • end: 261
                                  • loc: {...}
                                    • start: {...}
                                      • line: 9
                                      • column: 31
                                      }
                                    • end: {...}
                                      • line: 9
                                      • column: 32
                                      }
                                    }
                                  • value: 1
                                  • raw: "1"
                                  }
                                }
                              ]
                            • optional: false
                            }
                          • property: Identifier {...}
                            • type: "Identifier"
                            • start: 263
                            • end: 267
                            • loc: {...}
                              • start: {...}
                                • line: 9
                                • column: 34
                                }
                              • end: {...}
                                • line: 9
                                • column: 38
                                }
                              }
                            • name: "join"
                            }
                          • computed: false
                          • optional: false
                          }
                        • arguments: [...] (1)
                          • Literal {...}
                            • type: "Literal"
                            • start: 268
                            • end: 272
                            • loc: {...}
                              • start: {...}
                                • line: 9
                                • column: 39
                                }
                              • end: {...}
                                • line: 9
                                • column: 43
                                }
                              }
                            • value: ", "
                            • raw: "', '"
                            }
                          ]
                        • optional: false
                        }
                      • MemberExpression {...}
                        • type: "MemberExpression"
                        • start: 281
                        • end: 310
                        • loc: {...}
                          • start: {...}
                            • line: 9
                            • column: 52
                            }
                          • end: {...}
                            • line: 9
                            • column: 81
                            }
                          }
                        • object: Identifier {...}
                          • type: "Identifier"
                          • start: 281
                          • end: 289
                          • loc: {...}
                            • start: {...}
                              • line: 9
                              • column: 52
                              }
                            • end: {...}
                              • line: 9
                              • column: 60
                              }
                            }
                          • name: "flavours"
                          }
                        • property: BinaryExpression {...}
                          • type: "BinaryExpression"
                          • start: 290
                          • end: 309
                          • loc: {...}
                            • start: {...}
                              • line: 9
                              • column: 61
                              }
                            • end: {...}
                              • line: 9
                              • column: 80
                              }
                            }
                          • left: MemberExpression {...}
                            • type: "MemberExpression"
                            • start: 290
                            • end: 305
                            • loc: {...}
                              • start: {...}
                                • line: 9
                                • column: 61
                                }
                              • end: {...}
                                • line: 9
                                • column: 76
                                }
                              }
                            • object: Identifier {...}
                              • type: "Identifier"
                              • start: 290
                              • end: 298
                              • loc: {...}
                                • start: {...}
                                  • line: 9
                                  • column: 61
                                  }
                                • end: {...}
                                  • line: 9
                                  • column: 69
                                  }
                                }
                              • name: "flavours"
                              }
                            • property: Identifier {...}
                              • type: "Identifier"
                              • start: 299
                              • end: 305
                              • loc: {...}
                                • start: {...}
                                  • line: 9
                                  • column: 70
                                  }
                                • end: {...}
                                  • line: 9
                                  • column: 76
                                  }
                                }
                              • name: "length"
                              }
                            • computed: false
                            • optional: false
                            }
                          • operator: "-"
                          • right: Literal {...}
                            • type: "Literal"
                            • start: 308
                            • end: 309
                            • loc: {...}
                              • start: {...}
                                • line: 9
                                • column: 79
                                }
                              • end: {...}
                                • line: 9
                                • column: 80
                                }
                              }
                            • value: 1
                            • raw: "1"
                            }
                          }
                        • computed: true
                        • optional: false
                        }
                      ]
                    • quasis: [...] (3)
                      • TemplateElement {...}
                        • type: "TemplateElement"
                        • start: 239
                        • end: 239
                        • loc: {...}
                          • start: {...}
                            • line: 9
                            • column: 10
                            }
                          • end: {...}
                            • line: 9
                            • column: 10
                            }
                          }
                        • value: {...}
                          • raw: ""
                          • cooked: ""
                          }
                        • tail: false
                        }
                      • TemplateElement {...}
                        • type: "TemplateElement"
                        • start: 274
                        • end: 279
                        • loc: {...}
                          • start: {...}
                            • line: 9
                            • column: 45
                            }
                          • end: {...}
                            • line: 9
                            • column: 50
                            }
                          }
                        • value: {...}
                          • raw: " and "
                          • cooked: " and "
                          }
                        • tail: false
                        }
                      • TemplateElement {...}
                        • type: "TemplateElement"
                        • start: 311
                        • end: 311
                        • loc: {...}
                          • start: {...}
                            • line: 9
                            • column: 82
                            }
                          • end: {...}
                            • line: 9
                            • column: 82
                            }
                          }
                        • value: {...}
                          • raw: ""
                          • cooked: ""
                          }
                        • tail: true
                        }
                      ]
                    }
                  }
                ]
              }
            }
          ]
        • sourceType: "module"
        }
      • attributes: []
      }
    }
The AST is not public API and may change at any point in time
Group inputs • Playground • Svelte