回答編集履歴

1

調整

2018/10/10 09:22

投稿

yambejp
yambejp

スコア114883

test CHANGED
@@ -4,13 +4,23 @@
4
4
 
5
5
  ```javascript
6
6
 
7
- <script>
8
-
9
7
  function createTest(){
10
8
 
11
9
  var test=0;
12
10
 
11
+ Object.defineProperty(this,"test",
12
+
13
+ {
14
+
15
+ configurable:true,
16
+
17
+ enumerable:true,
18
+
19
+ get:function(){return test;},
20
+
13
- Object.defineProperty(this,"test",{configurable:true,enumerable:true,get:()=>{return test;},set:(newVal)=>{test=newVal;document.querySelector('#debug').value=newVal;}});
21
+ set:function(newVal){test=newVal;document.querySelector('#debug').value=newVal;}
22
+
23
+ });
14
24
 
15
25
  }
16
26
 
@@ -18,8 +28,10 @@
18
28
 
19
29
  setInterval(function(){obj.test=Math.random()},1000);
20
30
 
21
- </script>
31
+ ```
22
32
 
23
- <input type="text" id="debug" value=""/>
33
+ ※修正しました。IEなら9以上で動きます。
24
34
 
35
+ IE8以下はもっとローレベルのjsなのでオブジェクトからのアプローチは
36
+
25
- ```
37
+ キビシイでしょうね