File tree 1 file changed +23
-2
lines changed
1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change 1
1
# JavaScript-snippets
2
- > Click :star : if you like the project. Pull Request are highly appreciated. Follow us on [ Facebook] ( https://www.facebook.com/snippetsJS )
2
+ > Click :star : if you like the project. Pull Request are highly appreciated. Follow us on [ Facebook] ( https://www.facebook.com/snippetsJS )
3
3
4
4
### Table of Contents
5
5
| No. | Questions |
44
44
| 38 | [ How to change the value of an object which is inside an array] ( #How-to-change-the-value-of-an-object-which-is-inside-an-array ) |
45
45
| 39 | [ Numeric separators allow us to improve our code readability] ( #Numeric-separators-allow-us-to-improve-our-code-readability ) |
46
46
| 40 | [ pay attention when using every] ( #pay-attention-when-using-every ) |
47
-
47
+ | 41 | [ How to convert an array of key-value tuples into an object ] ( #How-to-convert-an-array-of-key-value-tuples-into-an-object ) |
48
48
49
49
50
50
@@ -880,6 +880,27 @@ console.log(result) //true
880
880
881
881
882
882
883
+ **[⬆ Back to Top](#table-of-contents)**
884
+ ### How to convert an array of key-value tuples into an object
885
+
886
+
887
+ ```javascript
883
888
889
+ const JSarr = [
890
+ ['name', 'JSsnippets'],
891
+ ['address', 'worldwide'],
892
+ ['year', '2018'],
893
+ ['followers', '15000']
894
+
895
+ ];
896
+
897
+ const obj = Object.fromEntries(JSarr);
898
+ //{
899
+ // " name" : " JSsnippets" ,
900
+ // " address" : " worldwide" ,
901
+ // " year" : " 2018 " ,
902
+ // " followers" : " 15000 "
903
+ //}
904
+ ```
884
905
885
906
You can’t perform that action at this time.
0 commit comments