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
| // with语句 | |
| // - with(变量a){可执行代码中的标识符b} | |
| // - 作用就是解析标识符b时,延长标识符b所在域的作用域链,把变量a添加在标识符b所在域的作用域链的最前端。 | |
| // - 首先把a当做标识符,在a所在域的作用域链中搜索a | |
| // - 如果变量a的值为undefined或者null,报错 | |
| // - 如果搜索不到变量a,报错 | |
| // - 如果搜索到变量a,且变量a值不是undefined或者null,就把a插入到b所在域的作用域链的最前端。接着就是标识符b的搜索问题 | |
| // - 如果变量a是对象,即window对象or普通对象,标识符b的搜索会首先在window对象or普通对象的内容中搜索,若搜索不到,则沿着作用域链向外搜索 | |
| // - 如果变量a是函数或者基本值,不会在函数体内搜索标识符b,而且标识符b不会被搜索到,标识符a才可以被搜索到, | |
| 而且搜索到的就是变量a本身。既然标识符b搜索不到,则沿着标识符b所在域的作用域链继续向外搜索 |
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
| //使用函数的嵌套 | |
| function ins1(A,B){ | |
| if(A.__proto__==null){ | |
| return false; | |
| }else if(A.__proto__.constructor==B){ | |
| return true; | |
| } | |
| else{ | |
| return ins1(A.__proto__,B); | |
| } |
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
| var currencyValidator = { | |
| format: function (number) { | |
| return (Math.trunc(number * 1000000000000) / 1000000000000).toFixed(2) | |
| }, | |
| parse: function (newString, oldNumber) { | |
| var CleanParse = function (value) { | |
| return { value: value } | |
| } | |
| var CurrencyWarning = function (warning, value) { | |
| return { |