Created
June 7, 2021 17:03
-
-
Save dimasmiftah/a0e77cb2f59d53a89a65f06ef5c4dcdf to your computer and use it in GitHub Desktop.
This file contains 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
// Kloning array | |
let nomor = [1, 2, 3] | |
let klonNomor = JSON.parse(JSON.stringify(nomor)) | |
console.log(klonNomor) | |
// [1, 2, 3] | |
// Kloning object | |
let binatang = {kucing: '🐱', tikus: '🐭'} | |
let klonBinatang = JSON.parse(JSON.stringify(binatang)) | |
console.log(klonBinatang) | |
// {kucing: '🐱', tikus: '🐭'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment