<input type="text" id="a">
<input type="button" value=" " id="btn">
<script>
(function(window){
var input = document.querySelector('#a');
var btn=document.querySelector('#btn');
btn.addEventListener('click',function(){
var v=input.value;
v = v - 0;
v = v * 2;
input.value = v;
});
})(window);
这样写什么意思。
王龙2018-10-15 21:43:09
(function(window){..})(window); This is to execute an anonymous function parameter window. How does JS understand such syntax.