【发布时间】:2021-04-26 13:52:15
【问题描述】:
您好,有人可以帮我解决这个问题吗? 我想在输入中写“company1”,将它与 input.value 一起显示在 score(paragraph) 中。
它应该看起来像“写company1并显示在分数foil1、foil2和foil3中”
const input = document.querySelector('input');
const score = document.querySelector('.score');
const prices = {
'company1': {
'foil1': {
'0-5000m2' : 0.67,
'5000-10000m2' : 0.65,
'10000-20000m2' : 0.63
},
'foil2': {
'0-5000m2' : 0.67,
'5000-10000m2' : 0.65,
'10000-20000m2' : 0.63
},
'foil': {
'0-5000m2' : 0.67,
'5000-10000m2' : 0.65,
'10000-20000m2' : 0.63
}
}
}
btnSearch.addEventListener('click',()=>{
const company = input.value;
const foil = Object.keys(company) - I know that here is problem, but dont know how make it correctly
console.log(foil); and here is problem becasue its return numbers = Array(8) [ "0", "1", "2", "3", "4", "5", "6", "7" ]
})
【问题讨论】:
标签: javascript object key