Created
January 2, 2017 17:42
-
-
Save AGhost-7/a1721610cbd94f7966345b7620e11e7a to your computer and use it in GitHub Desktop.
How long will it take for Linux desktop shares to surpass macOS? (12 months)
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
// data source: https://www.netmarketshare.com/operating-system-market-share.aspx?qprid=9&qpcustomb=0&qpsp=204&qpnp=13&qptimeframe=M | |
const osx = [7.87, 7.37, 6.92, 6.43, 6.74, 6.07] | |
const linux = [2.33, 2.11, 2.23, 2.18, 2.31, 2.21] | |
const changes = (list) => list.slice(1).map((share, i) => share - list[i]) | |
const avg = (list) => list.reduce((accu, val) => accu + val, 0) / list.length | |
const linuxAvgChange = avg(changes(linux)) | |
const osxAvgChange = avg(changes(osx)) | |
const linuxCurrentShare = linux[linux.length - 1] | |
const osxCurrentShare = osx[osx.length - 1] | |
const linuxOvertake = (months) => { | |
if((linuxCurrentShare + (months * linuxAvgChange)) > (osxCurrentShare + (months * osxAvgChange))) { | |
return months | |
} else { | |
return linuxOvertake(months + 1) | |
} | |
} | |
console.log('Linux overtakes macOs:', linuxOvertake(1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment