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
| print('Converting') | |
| try: | |
| print(int('x')) | |
| except: | |
| print('Converting failed!') | |
| else: | |
| print('Converting successful!') | |
| finally: | |
| print('done') |
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
| /* 检测对象类型 | |
| * @param: obj {JavaScript Object} | |
| * @param: typeStr {String} 以大写开头的 JS 类型名 | |
| * @return: {Boolean} | |
| */ | |
| function isType(obj, typeStr) { | |
| return Object.prototype.toString.call(obj).slice(8, -1) === typeStr; | |
| } |
OlderNewer