딕셔너리 for 루프

1 JavaScript[ | ]

let d = { 'id': 42, 'name': 'John Smith', 'birthyear': 2000 };
for(let key in d) {
    console.log( key, ':', d[key] );
}
// id : 42
// name : John Smith
// birthyear : 2000

2 PHP[ | ]

<?php
$arr = [ 'id'=> 42, 'name'=>'John Smith', 'birthyear'=>2000 ];
foreach( $arr as $key => $value ) {
    echo "$key: $value\n";
}
# id: 42
# name: John Smith
# birthyear: 2000

3 Python[ | ]

d = { 'id': 42, 'name': 'John Smith', 'birthyear': 2000 }
for key, value in d.items():
    print( key, ':', value )
# id : 42
# name : John Smith
# birthyear : 2000
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}