x
 
<!DOCTYPE html>
<html>
<body>
<h2>Declaring an Array Using const</h2>
<p id="demo"></p>
<script>
var cars = ["Saab", "Volvo", "BMW"];
// Here cars[0] is "Tesla"
{  
  var cars = ["Toyota", "Volvo", "BMW"]; 
  // Here cars[0] is "Toyota"
}
// Here cars[0] is "Toyota"
document.getElementById("demo").innerHTML = cars[0];
</script>
</body>
</html>