Created
July 12, 2017 17:57
-
-
Save anonymous/9411dafb1ee6f28db000cc2975f1fa0f to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/qanidipoze
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"> | |
var input = [ | |
{ key: "your_tier", value: "your current tier" }, | |
{ key: "your_body", value: "lorem ipsum ispum cenas common" } | |
]; | |
var expected = { | |
your_tier: "your current tier", | |
how_works_txt_1: "Lorem ipsum dolor sit amet" | |
}; | |
function blackbox(data) { | |
let i | |
let output = {} | |
for (const key in data) { | |
output[data[key].key] = data[key].value | |
} | |
return output | |
} | |
console.log(blackbox(input)); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var input = [ | |
{ key: "your_tier", value: "your current tier" }, | |
{ key: "your_body", value: "lorem ipsum ispum cenas common" } | |
]; | |
var expected = { | |
your_tier: "your current tier", | |
how_works_txt_1: "Lorem ipsum dolor sit amet" | |
}; | |
function blackbox(data) { | |
let i | |
let output = {} | |
for (const key in data) { | |
output[data[key].key] = data[key].value | |
} | |
return output | |
} | |
console.log(blackbox(input));</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
var input = [ | |
{ key: "your_tier", value: "your current tier" }, | |
{ key: "your_body", value: "lorem ipsum ispum cenas common" } | |
]; | |
var expected = { | |
your_tier: "your current tier", | |
how_works_txt_1: "Lorem ipsum dolor sit amet" | |
}; | |
function blackbox(data) { | |
let i | |
let output = {} | |
for (const key in data) { | |
output[data[key].key] = data[key].value | |
} | |
return output | |
} | |
console.log(blackbox(input)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment