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
| fun_1 =(n)=> { | |
| let varr =n; | |
| return () => { | |
| return varr; | |
| }; | |
| } | |
| var a = fun_1(1); | |
| var b = fun_1(2); | |
| console.log(a()); |
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
| funn = (first, seconds) => { | |
| if (exponent == 0) | |
| return 1; | |
| else | |
| return first * seconds(first, seconds - 1); | |
| } | |
| console.log(power(2, 3)); |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> | |
| <link rel="stylesheet" type="text/css" href="style.css"> | |
| <title>Hello, world!</title> | |
| </head> | |
| <body> |
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
| function chicken() { | |
| return egg(); | |
| } | |
| function egg() { | |
| return chicken(); | |
| } | |
| console.log(chicken() + " Came first?."); |
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
| var Obj = () => { | |
| var id =1; | |
| return { | |
| getID: () => { | |
| return id; | |
| }, | |
| setID: (id2) => { | |
| id=id2; | |
| // console.log(id2); //* | |
| }}} |
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
| var learn = { | |
| programmelanguage:{ | |
| web: {fontend : "HTML-CSS-JS", | |
| backend: ".NET-MONGODB-DATABASE"}, | |
| web_app: "NODEJS-REACT-ANGULAR-JS++", | |
| mobile: { | |
| android: "JAVA-KOTLIN", | |
| ios: "OBJECTIVE_C..."}, | |
| desktop: { | |
| windows: "C-C++-.NET...", |
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
| var abc = ['a','b','c'], def = ['d','e','f']; | |
| var sum = [...abc, ...def]; | |
| console.log(sum); | |
| //Result: ["a", "b", "c", "d", "e", "f"] |
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
| // 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; |
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
| const [a, b, ...arr] = [1, 2, 3, 4, 5, 7]; | |
| console.log(a, b); // 1, 2 | |
| console.log(arr); // [3, 4, 5, 7] | |
| // => a = [0], tương tự vậy b[1], nhưng ...arr sẽ lấy hết các phần còn lại bao gồm arr[n++] tiếp theo sau đó. |
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
| //MAP | |
| let arr1 = [1,2,4]; | |
| let arr2 = arr1.map(X=>X*2); | |
| console.log(arr2); //[2, 4, 8] | |
| console.log(arr1); //[1, 2, 4] | |
| //Việc thực thi mảng sẽ diễn ra theo trình tự clone rồi mới sửa (tránh phá nát mảng ban đâu), sau đó đưa kết quả cho arr2. | |
| //FILTER | |
| let arr1 = [1,2,4]; | |
| let arr2 = arr1.filter(X=>X>3); |
OlderNewer