es6:Destructoring

In this example below you will see how to do a es6:Destructoring with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by wuxiaolan91, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright wuxiaolan91 ©

Technologies

  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>es6:Destructoring</title>
  
  
  
  
  
</head>

<body>

  
  <script src='https://unpkg.com/vue/dist/vue.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/wuxiaolan91/es6destructoring-dJaeqd */
let userObj ={
  id: 3,
  name: 'xiaolan',
  age: 28
}
let name1 = userObj.name1;
let id1 = userObj.id;
let age1 = userObj.age1;
// Destrectoring
let [name2, id2, age2] = userObj;

Comments