title: detect country code by a given phone number in javascript
body: <p>I have an object with all available country codes. and I want to know how I can get the country code by a given phone number and display the corresponding country name. the phone number will look like 16041234567(Canada/US +1) or maybe 8601012345678(China +86) or any other country phone number without plus(+) in the front. I just want to get the country code then I know how to display the name. looks like the code can be 1 up to 4 digits. </p>