- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>JavaScript ES6 Array Destructuring Assignment</title>
- </head>
- <body>
- <script>
- // ES6 syntax
- let fruits = ["Apple", "Banana"];
- let [a, b] = fruits; // Array destructuring assignment
- document.write(a); // Apple
- document.write("<br>");
- document.write(b); // Banana
- </script>
- </body>
- </html>