Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/447.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 忽略数组值_Javascript_Jquery_Angularjs - Fatal编程技术网

Javascript 忽略数组值

Javascript 忽略数组值,javascript,jquery,angularjs,Javascript,Jquery,Angularjs,我有两个数组,试图实现一种方法,首先加载数据,然后我有一个不同的数组,我需要从中添加价格,忽略han产品 发生的情况是,根据跳过的han产品数量,第二个数组忽略了其索引值的数量 如何通过跳过han产品将适当的价格值附加到数组中来实现这一点 例如: First Array : $scope.results = results[i]; Second Array : var nPrice = []; nPrice=response.data for(var i=0;i<$scope.resu

我有两个数组,试图实现一种方法,首先加载数据,然后我有一个不同的数组,我需要从中添加价格,忽略han产品

发生的情况是,根据跳过的han产品数量,第二个数组忽略了其索引值的数量

如何通过跳过han产品将适当的价格值附加到数组中来实现这一点

例如:

First Array : $scope.results = results[i];

Second Array : var nPrice = []; nPrice=response.data

for(var i=0;i<$scope.results.length;i++){
if($scope.results[i].type==“han”)
    console.log(“Han Product”);
}
else{
    $scope.results[i].cPrice = nPrice[i].curPrice;
}
第一个数组:$scope.results=results[i];
第二个数组:var nPrice=[];nPrice=response.data

对于(var i=0;i如何显示第一个和第二个阵列的真实数据)您是否可以为此制作一个工作JS FIDLE或Plunkr?