Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Arrays</h1> <h2>Bracket Notation</h2> <p>The bracket notation [] returns an indexed element from an array:</p> <p id="demo"></p> <script> const fruits = ["Banana", "Orange", "Apple", "Mango"]; let fruit = fruits[2]; document.getElementById("demo").innerHTML = fruit; </script> </body> </html>