Created
August 16, 2023 16:17
-
-
Save suhailgupta03/a4ac188a30d5235154682956b3ef6524 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let arr = [1,2,3,4]; | |
// console.log(arr[0]); // 1 | |
// console.log(arr[1]); // 2 | |
// console.log(arr[2]); // 3 | |
const [f, s] = arr; | |
// the above concept is called | |
// destructuring because we are | |
// destructuring the array into | |
// two variables f and s | |
console.log(f); // 1 | |
console.log(s); // 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Object example: https://gist.github.com/suhailgupta03/c7ed3f9b8e0beea51f43e2f19f745515