Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何遍历对象中的键以显示与其关联的键和值?假设哈希如下:
hash = a: 'b' c: 'd' e: 'f'
for key, value of hash console.log "#{key} = #{value}"
尝试这个:
for k, v of hash console.log('%s %s', k, v)