Skip to content

Instantly share code, notes, and snippets.

@tranduclinh2067
Last active January 12, 2019 04:06
Show Gist options
  • Save tranduclinh2067/89742a36cbf7abb20f541b6bb145eeca to your computer and use it in GitHub Desktop.
Save tranduclinh2067/89742a36cbf7abb20f541b6bb145eeca to your computer and use it in GitHub Desktop.
Phân tách cơ cấu
// Tách các phần tử của Array hoặc Object thành nhiều biến chỉ bằng một đoạn code duy nhất.
//Array [a,b,c]
let date_Array = [20,06,1997]
let [,, c] = date_Array;
console.log(c);
//Object {d,m,y}
let date_Object = { day : 20, month : 06, year : 1997 }
let {day : d, month : m, year : y} = date_Object;
console.log(y);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment