!function(){} is placed in the js file. How to call the method inside after referencing it?
// 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>
Just return the internal method
!function(){} is not a method, but an expression with a value of false.
!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
Just return the internal method
!function(){} is not a method, but an expression with a value of false.
!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