apply方法不适用于所有数组的元素 [英] apply method not applying in all array's element

查看:96
本文介绍了apply方法不适用于所有数组的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script>
              function negate(func)
              {
                  return function()
                  {
                      console.log(arguments);
                      return !func.apply(null,arguments);
                  }
              }
              var isNotaNmber= negate(isNaN);
              document.write(isNotaNmber(["1000",332,"iioi"]));

          </script>



这只显示一个值false。但我猜应用方法应该应用三次,它需要返回三个布尔运算。但我不知道为什么它只向我显示一个布尔操作'False'


this is showing only one value false. But i guess apply method should apply three times and it needs to return me three boolean operation. but i dont know why its showing me only one boolean operatoin 'False'

推荐答案

在所有乱七八糟的结束时你所做的就是用数组调用isNaN ([ 1000,332 iioi])。当然,这不是一个数字 - 它是一个数组......
At the end of all the mess you have what you do is calling isNaN with an array (["1000",332,"iioi"]). For sure it's not a number - it's an array...


这篇关于apply方法不适用于所有数组的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆