存储javascript的数组
我有一个数组,我想为不同的值创建不同的数组。这是我的阵列存储javascript的数组,javascript,arrays,Javascript,Arrays,我有一个数组,我想为不同的值创建不同的数组。这是我的阵列 var data = [{ "rateType": "Fixed", "interestRateMin": "12.0", "imageUrl": "\/images\/dyn\/null.jpg", "financingPercentageMax": "80", "interestRateMax": "12.0", "prePaymentCharge": "Ni
var data = [{
"rateType": "Fixed",
"interestRateMin": "12.0",
"imageUrl": "\/images\/dyn\/null.jpg",
"financingPercentageMax": "80",
"interestRateMax": "12.0",
"prePaymentCharge": "Nil",
"financingPercentageMin": "60",
"bankName": "Muthoot Finance",
"security": "Pledge of the gold ornaments and coins.",
"repaymentTenureInYears": "0.25",
"age": "35",
"processingFee": "Nil",
"maxLoanAmt": "10000000"
}, {
"rateType": "Floating",
"interestRateMin": "12.5",
"imageUrl": "\/images\/dyn\/94.jpg",
"financingPercentageMax": "90",
"interestRateMax": "12.5",
"prePaymentCharge": "DNA",
"financingPercentageMin": "75",
"bankName": "Federal Bank- Gold loan",
"security": "DNA",
"repaymentTenureInYears": "1",
"age": "35",
"processingFee": "DNA",
"maxLoanAmt": "7500000"
}, {
"rateType": "Floating",
"interestRateMin": "13.0",
"imageUrl": "\/images\/dyn\/155.jpg",
"financingPercentageMax": "80",
"interestRateMax": "13.0",
"prePaymentCharge": "DNA",
"financingPercentageMin": "80",
"bankName": "State Bank of Travancore- Liquid loan",
"security": "Pledge of gold ornaments",
"repaymentTenureInYears": "1",
"age": "35",
"processingFee": "DNA",
"maxLoanAmt": "1000000"
}, {
"rateType": "Floating",
"interestRateMin": "13.25",
"imageUrl": "\/images\/dyn\/151.jpg",
"financingPercentageMax": "80",
"interestRateMax": "13.25",
"prePaymentCharge": "DNA",
"financingPercentageMin": "80",
"bankName": "State Bank Of Hyderabad- Overdraft",
"security": "Pledge of Gold ornaments or Jewellery made of 22 Carat or 18 Carat",
"repaymentTenureInYears": "3",
"age": "35",
"processingFee": "1.10% of the original limit or max Rs 330",
"maxLoanAmt": "1500000"
}, {
"rateType": "Floating",
"interestRateMin": "14.5",
"imageUrl": "\/images\/dyn\/161.jpg",
"financingPercentageMax": "80",
"interestRateMax": "14.5",
"prePaymentCharge": "DNA",
"financingPercentageMin": "80",
"bankName": "Lakshmi Vilas Bank",
"security": "Pledge of gold ornaments",
"repaymentTenureInYears": "1",
"age": "35",
"processingFee": "0.50% of the limit sanctioned, min Rs 100",
"maxLoanAmt": "5000000"
}];
我想将所有rateType存储在一个数组中。像这样,我想制作不同的数组来存储其他元素。有人能给我介绍一下这个吗如果你想在
数据
对象中获得一个rateType
s数组(例如),你可以这样做:
var数据=[{rateType:“Fixed”,interestRateMin:“12.0”,imageUrl:“/images/dyn/null.jpg”,financingPercentageMax:“80”,interestRateMax:“12.0”,预付费:“Nil”,financingPercentageMin:“60”,银行名称:“联名金融”,证券:“黄金饰品和硬币的质押”,还款年限:“0.25”,年龄:“35”,手续费:“零”,最高贷款:“10000000”},{rateType:“浮动”,interestRateMin:“12.5”,imageUrl:“/images/dyn/94.jpg”,financingPercentageMax:“90”,interestRateMax:“12.5”,预付费:“DNA”,financingPercentageMin:“75”,银行名称:“联邦银行-黄金贷款”,证券:“DNA”,还款期限:“1”,年龄:“35”,处理费:“DNA”,maxLoanAmt:“7500000”},{rateType:“浮动”,interestRateMin:“13.0”,imageUrl:“/images/dyn/155.jpg”,Financing PercentageMax:“80”,interestRateMax:“13.0”,预付费:“DNA”,Financing PercentageMin:“80”,银行名称:“Travancore国家银行-流动贷款”,证券:“黄金饰品抵押”,还款期限:“1”,年龄:“35”,处理费:“DNA”,最大贷款金额:“1000000”},利率类型:“浮动”,利息率:“13.25”,imageUrl:“/images/dyn/151.jpg”,Financing PercentageMax:“80”,interestRateMax:“13.25”,预付费:“DNA”,Financing Percentagemin:“80”,银行名称:“海得拉巴国家银行-透支”,证券:“22克拉或18克拉黄金饰品或珠宝的抵押”,还款期限:“3”,年龄:“35”,手续费:“原始限额的1.10%或最高330卢比”,maxLoanAmt:“1500000”},{rateType:“浮动”,interestRateMin:“14.5”,imageUrl:“/images/dyn/161.jpg”,Financing PercentageMax:“80”,interestRateMax:“14.5”,预付款费用:“DNA”,Financing PercentageMin:“80”,银行名称:“Lakshmi Vilas Bank”,证券:“黄金饰品抵押”,还款期限:“1”,年龄:“35,处理费:“批准限额的0.50%,最低100卢比”,maxLoanAmt:“5000000”});
var结果=[];
data.forEach(函数(元素){
此.push(元素.rateType);
},结果);
控制台日志(结果)
你需要迭代这个数组并创建一个具有[rateType]值的新数组吗?你能解释更多吗?新数组应该包含什么?使用。我想为rateType创建一个单独的数组,并将所有rateType值存储在iti中。我已经更新了该数组。这是我的阵列非常感谢你@kukkuz