Destructing OF ARRAY IN REACT JS

 <!DOCTYPE html>

<html>


<body>


<p id="demo"></p>

  

<script>

const vehicleOne = {

  brand: 'Ford',

  model: 'Mustang',

  type: 'car',

  year: 2021, 

  color: 'red'

}


myVehicle(vehicleOne);


function myVehicle({type, color, brand, model}) {

  const message = 'My ' + type + ' is a ' + color + ' ' + brand + ' ' + model + '.';


  document.getElementById("demo").innerHTML = message;

}

</script>


</body>

</html>


Comments

Popular posts from this blog

Class File

Dependencies