Last active
August 29, 2015 14:04
-
-
Save aNd1coder/352acd2312a12dc16cb6 to your computer and use it in GitHub Desktop.
javascript utility function
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
// Add commas to numbers | |
function addCommas(n) { | |
return String(n).replace(/(\d)(?=(\d{3})+$)/g, '$1,') | |
} | |
//check the browser environment | |
function isWeiXinEnv(){ | |
var ua = window.navigator.userAgent.toLowerCase(); | |
return ua.match(/MicroMessenger/i) == 'micromessenger'; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment