PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Assign value to multiple variables at once in Javascript

Assign value to multiple variables at once in Javascript

Written by Ejaaz Khan on Sep 29th, 2021 Views Report Post

The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.

<pre class="highlight plaintext">```  
    let [a,b,c] = [1,2,3];

    console.log(a,b,c);




Output:

[![Output](https://res.cloudinary.com/practicaldev/image/fetch/s--cuVKCvS1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3b8yxsbyhx8e3c9634r9.PNG)](https://res.cloudinary.com/practicaldev/image/fetch/s--cuVKCvS1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3b8yxsbyhx8e3c9634r9.PNG)    
My Blog:- <https://beginners-developer.blogspot.com/>    
Reference: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring\_assignment](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment)

Comments (0)

loading comments