This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CONTOH MUTABLE - OBJECT LITERAL | |
let pemain1 = {nama: 'hinata', umur: 15} | |
let pemain2 = pemain1 | |
pemain2.nama = 'shoyo' | |
console.log(pemain1) // akan menampilkan {nama: "shoyo", umur: 15} | |
console.log(pemain2) // akan menampilkan {nama: "shoyo", umur: 15} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CONTOH IMMUTABLE - NUMBER | |
let umur1 = 15 | |
let umur2 = umur1 - 5 | |
console.log(umur1) // akan menampilkan 15 | |
console.log(umur2) // akan menampilkan 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CONTOH IMMUTABLE - STRING | |
let nama1 = 'hinata' | |
let nama2 = nama1 + ' shoyo' | |
console.log(nama1) // akan menampilkan 'hinata' | |
console.log(nama2) // akan menampilkan 'hinata shoyo' |
NewerOlder