untuk ... di ... loop
const obj = {
a: 1,
b: 2,
c: 3,
d: 4
}
for (const key in obj) {
console.log( obj[key] )
}
// Result: 1, 2, 3, 4
Enchanting Echidna
const obj = {
a: 1,
b: 2,
c: 3,
d: 4
}
for (const key in obj) {
console.log( obj[key] )
}
// Result: 1, 2, 3, 4
#list comprehension: squaring numbers in a list a list.
cardinals = [1,2,3,4,5]
squares = [i**2 for i in cardinals]
print(squares)