1 JavaScript[ | ]

JavaScript
Copy
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
Copy
<?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[ | ]

Python
Copy
d = { 'id': 42, 'name': 'John Smith', 'birthyear': 2000 }
for key, value in d.items():
print( key, ':', value )
# id : 42
# name : John Smith
# birthyear : 2000
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.