Horje Website
JavaScript ES6 Using Rest Operator Array Destructuring Assignment – JavaScript Code

JavaScript ES6 Using Rest Operator Array Destructuring Assignment

JavaScript ES6 Using Rest Operator Array Destructuring Assignment - JavaScript Code


 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JavaScript ES6 Using Rest Operator Array Destructuring Assignment</title>
  6. </head>
  7. <body>
  8. <script>
  9. // ES6 syntax
  10. let fruits = ["Apple", "Banana", "Mango"];
  11. let [a, ...r] = fruits;
  12. document.write(a); // Apple
  13. document.write("<br>");
  14. document.write(r); // Banana,Mango
  15. document.write("<br>");
  16. document.write(Array.isArray(r)); // true
  17. </script>
  18. </body>
  19. </html>



Try Your Self ->



Published:
September 12, 2020
Author:
admin
Category:
JavaScript Example, Javascript Source Code
Views:
18

This article was posted in JavaScript Example, Javascript Source Code and tagged , , . Bookmark the permalink. Follow comments with the RSS feed for this post.Post a Comment or leave a trackback: Trackback URL.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Horje © 2011 - 2022