diff --git a/every morning/0112.js b/every morning/0112.js new file mode 100644 index 0000000..f93cbfc --- /dev/null +++ b/every morning/0112.js @@ -0,0 +1,5 @@ +var a = {n:1} +var b = a +a.x = a = {n:2} +console.log(a.x) +console.log(b) \ No newline at end of file diff --git a/every morning/0113.js b/every morning/0113.js new file mode 100644 index 0000000..9f4843c --- /dev/null +++ b/every morning/0113.js @@ -0,0 +1,18 @@ +var x = 3, //12 +obj = { + x:5 +}; +obj.fn = (function () { + this.x *= ++x //12 + return function (y) { + this.x *= (++x) + y // + console.log(x) //13 + } +})() + +var fn = obj.fn +obj.fn(6) // 13 +fn(4) //234 +console.log(obj.x, x) //95 234 + +//g: x 13 o:x 95 \ No newline at end of file