3 ms·
Thats because your use case isn't real. In js, its usually used to generate select option (example in react): for(let optValue of Object.keys(options)){
by fendy3002 6y ago
Thats because your use case isn't real. In js, its usually used to generate select option (example in react):
for(let optValue of Object.keys(options)){
optDom.push(
<option key={optValue} value={optValue}>{options[optValue]}</option>
)
}
Of course array also works, but with json object, it guarantee that the value will be distinct and you don't need specific array object type.