File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 4949| 43 | [ toFixed] ( #toFixed ) |
5050| 44 | [ generate randomUUID] ( #generate-random-uuid ) |
5151| 45 | [ structuredClone] ( #structuredClone ) |
52-
53-
54-
52+ | 46 | [ get device orientation] ( #get-device-orientation ) |
5553
5654
5755** [ ⬆ Back to Top] ( #table-of-contents ) **
@@ -981,4 +979,18 @@ console.log("clonedUser.address.street:", clonedUser.address.street);
981979// > New Road
982980
983981
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+
984996```
You can’t perform that action at this time.
0 commit comments