Created
December 12, 2019 23:48
-
-
Save angelyoung24/89bc12a818ee328f1483d7e4a3d344f5 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/mizodunuwi
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
const pet = {type: "cat", name: "Mutumbo", age:"5"}; | |
const keys = Object.keys(pet); | |
const emptyObject = {}; | |
keys.forEach(key => { | |
const value = pet[key] | |
emptyObject[value] = key; | |
}); | |
console.log(emptyObject); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
const pet = {type: "cat", name: "Mutumbo", age:"5"}; | |
const keys = Object.keys(pet); | |
const emptyObject = {}; | |
keys.forEach(key => { | |
const value = pet[key] | |
emptyObject[value] = key; | |
}); | |
console.log(emptyObject); | |
</script></body> | |
</html> |
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
const pet = {type: "cat", name: "Mutumbo", age:"5"}; | |
const keys = Object.keys(pet); | |
const emptyObject = {}; | |
keys.forEach(key => { | |
const value = pet[key] | |
emptyObject[value] = key; | |
}); | |
console.log(emptyObject); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment