Object looping in Python vs Javascript

Python

obj = {
    'name': 'Victor'
}

for key in obj:
    print("key: %s, value: %s" % (key, obj[key]))

Enter fullscreen mode Exit fullscreen mode


Javascript:

let obj = {
    name: 'Victor'
}

for (key in obj) {
    console.log(`Key: ${key}, value: ${obj[key]}`);
}

Enter fullscreen mode Exit fullscreen mode

原文链接:Object looping in Python vs Javascript

© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容