JavaScript之函数直接量、匿名函数(function(x,y){}())写法及示例

JavaScript之函数直接量(function(x,y){}())写法和用途,就像java的匿名类一样,定义并立即执行一个函数,并在函数本体中立即得到返回值。

var _0x4818 = ['csKHwqMI', 'ZsKJwr8VeAsy', 'UcKiN8O/wplwMA==', 
'JR8CTg==', 'YsOnbSEQw7ozwqZKesKUw7kwX8ORIQ==', 'w7oVS8OSwoPCl3jChMKhw6HDlsKXw4s/YsOG', 
'fwVmI1AtwplaY8Otw5cNfSgpw6M=', 'OcONwrjCqsKxTGTChsOjEWE8PcOcJ8K6', 'U8K5LcOtwpV0EMOkw47DrMOX', 
'HMO2woHCiMK9SlXClcOoC1k=', 'asKIwqMDdgMuPsOKBMKcwrrCtkLDrMKBw64d', 'wqImMT0tw6RNw5k=', 
'DMKcU0JmUwUv', 'VjHDlMOHVcONX3fDicKJHQ==', 'wqhBH8Knw4TDhSDDgMOdwrjCncOWwphhN8KCGcKqw6dHAU5+wrg2JcKaw4IEJcOcwrRJwoZ0wqF9YgAV',
 'dzd2w5bDm3jDpsK3wpY=', 'w4PDgcKXwo3CkcKLwr5qwrY=',
  'wrJOTcOQWMOg', 'wqTDvcOjw447wr4=', 'w5XDqsKhMF1/', 'wrAyHsOfwppc',
   'J3dVPcOxLg==', 'wrdHw7p9Zw==', 'w4rDo8KmNEw=',
    'IMKAUkBt', 'w6bDrcKQwpVHwpNQwqU=', 'd8OsWhAUw7YzwrU=', 'wqnCksOeezrDhw==', 
    'UsKnIMKWV8K/', 'w4zDocK8NUZv', 'c8OxZhAJw6skwqJj', 'PcKIw4nCkkVb', 
    'KHgodMO2VQ==', 'wpsmwqvDnGFq', 'wqLDt8Okw4c=', 'w7w1w4PCpsO4wqA=', 
    'wq9FRsOqWMOq', 'byBhw7rDm34=', 'LHg+S8OtTw==', 'wqhOw715dsOH', 
    'U8O7VsO0wqvDvcKuKsOqX8Kr', 'Yittw5DDnWnDrA==', 'YMKIwqUUfgIk', 'aB7DlMODTQ==',
     'wpfDh8Orw6kk', 'w7vCqMOrY8KAVk5OwpnCu8OaXsKZP3DClcKyw6HDrQ==', 
     'wow+w6vDmHpsw7Rtwo98LC7CiG7CksORT8KlW8O5wr3Di8OTHsODeHjDmcKlJsKqVA==',
      'NwV+', 'w7HDrcKtwpJawpZb', 'wpQswqvDiHpuw6I=', 'YMKUwqMJZQ==', 
      'KH1VKcOqKsK1', 'fQ5sFUkkwpI=', 'wrvCrcOBR8Kk', 'M3w0fQ==', 'w6xXwqPDvMOFwo5d'];
(function(_0x4c97f0, _0x1742fd) {
    console.log("Array Length ="+_0x4818.length);
    console.log(_0x4c97f0[_0x1742fd])
}(_0x4818, 0x2E));

上面的返回值为下图内容:匿名函数形参: (_0x4c97f0, _0x1742fd),实参:(_0x4818, 0x2E),_0x4818为一长度56的字符串大数组,实参0x2E =十进制46,结果打印出_0x4818[46]的值,因为String下标均为0,所以打印出来的是第45条内容

 

想了解更多js function详情可见我的另一篇博客文章

https://blog.csdn.net/wh445306/article/details/103624381

 

 

posted @ 2022-10-04 00:15  IT情深  阅读(56)  评论(0编辑  收藏  举报