!function(){} is placed in the js file. How to call the method inside after referencing it?
为情所困2017-05-19 10:15:21
// test.js
!function(){
var a = function(){console.log(1)}
this.demo = a;
}();
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<script src="test.js"></script>
</head>
<body>
<SCRIPT>
demo()
</SCRIPT>
</body>
</html>
我想大声告诉你2017-05-19 10:15:21
!function(){} is not a method, but an expression with a value of false.
怪我咯2017-05-19 10:15:21
!function means executing the function immediately. You need to see if there are any methods open to the outside world inside the function, such as modifying the properties of the window object