File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 49
49
| 43 | [ toFixed] ( #toFixed ) |
50
50
| 44 | [ generate randomUUID] ( #generate-random-uuid ) |
51
51
| 45 | [ structuredClone] ( #structuredClone ) |
52
-
53
-
54
-
52
+ | 46 | [ get device orientation] ( #get-device-orientation ) |
55
53
56
54
57
55
** [ ⬆ Back to Top] ( #table-of-contents ) **
@@ -981,4 +979,18 @@ console.log("clonedUser.address.street:", clonedUser.address.street);
981
979
// > New Road
982
980
983
981
982
+ ```
983
+
984
+ **[⬆ Back to Top](#table-of-contents)**
985
+ ### get device orientation
986
+
987
+ Browsers expose a global variable named screen, which we’ll use to access the information we need.
988
+
989
+ ```javascript
990
+
991
+ function getOrientation() {
992
+ const isPortrait = screen.orientation.type.startswith('portrait')
993
+ return isPortrait ? 'portrait' : 'landscape'
994
+ }
995
+
984
996
```
You can’t perform that action at this time.
0 commit comments