私は行って、JSは自ら匿名の関数を実行して意外にも20種類の書き方があります!
1631 ワード
新しい自己実行の書き方が見つかりました.
{ var x; x=1; alert(x);} //2013-01-30 14:45:57
// ,20
//
//
( function(w) {
alert(w.location.href+","+11);
}(window));
[ function(w) {
alert(w.location.href+","+11);
}(window) ];
//
~ function(w) {
alert(w.location.href+","+11);
}(window);
! function(w) {
alert(w.location.href+","+11);
}(window);
+ function(w) {
alert(w.location.href+","+11);
}(window);
- function(w) {
alert(w.location.href+","+11);
}(window);
//
delete function(w) {
alert(w.location.href+","+11);
}(window);
typeof function(w) {
alert(w.location.href+","+11);
}(window);
void function(w) {
alert(w.location.href+","+11);
}(window);
new function(w) {
alert(w.location.href+","+11);
}(window);
new function() {
alert(window.location.href+","+11);
};
//
var f = function(w) {
alert(w.location.href+","+11);
}(window);
//
1, function() {
alert(window.location.href+","+11);
}();
1 ^ function() {
alert(window.location.href+","+11);
}();
1 > function() {
alert(window.location.href+","+11);
}();
1 < function() {
alert(window.location.href+","+11);
}();
1 / function() {
alert(window.location.href+","+11);
}();
1 * function() {
alert(window.location.href+","+11);
}();
1 | function() {
alert(window.location.href+","+11);
}();
1 % function() {
alert(window.location.href+","+11);
}();
1 & function() {
alert(window.location.href+","+11);
}();