Last active
April 28, 2017 07:49
-
-
Save xhlwill/3e4dffe25eb5e885e6337a253d609fba to your computer and use it in GitHub Desktop.
calculate the PPI of screen
This file contains 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 ppi = function(height, width, inch) { | |
return Math.round(Math.sqrt(height*height + width*width) / inch); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
iPhone 4/4s: 330
iPhone 5/5s/se: 326
iPhone 6/6s/7: 326
iPhone 6 plus/6s plus/7 plus: 401