Skip to content

Instantly share code, notes, and snippets.

@santarinto
Created May 31, 2019 11:10
Show Gist options
  • Save santarinto/5aa853f161e59b0ded85ac53e90ae942 to your computer and use it in GitHub Desktop.
Save santarinto/5aa853f161e59b0ded85ac53e90ae942 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/guwoqur
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
textarea {
width: 100%;
min-height: 250px;
}
button {
margin-top: 3px;
margin-bottom: 3px;
width: 100%;
}
</style>
</head>
<body>
<textarea id="in"></textarea>
<button type="button" id="convert">convert</button>
<textarea id="out"></textarea>
<script id="jsbin-javascript">
'use strict';
var tin = document.getElementById('in');
var cnvrt = document.getElementById('convert');
var out = document.getElementById('out');
var h = function h() {
out.value = '';
var obj = JSON.parse(tin.value);
for (var k in obj) {
out.value += "+ " + k + ": ";
out.value += obj[k] + "\n";
}
};
cnvrt.addEventListener('click', h);
</script>
<script id="jsbin-source-css" type="text/css">textarea {
width: 100%;
min-height: 250px;
}
button {
margin-top: 3px;
margin-bottom: 3px;
width: 100%;
}</script>
<script id="jsbin-source-javascript" type="text/javascript">const tin = document.getElementById('in');
const cnvrt = document.getElementById('convert');
const out = document.getElementById('out');
const h = () => {
out.value = '';
const obj = JSON.parse(tin.value);
for (let k in obj) {
out.value += "+ " + k + ": ";
out.value += obj[k] + "\n";
}
};
cnvrt.addEventListener('click', h);</script></body>
</html>
textarea {
width: 100%;
min-height: 250px;
}
button {
margin-top: 3px;
margin-bottom: 3px;
width: 100%;
}
'use strict';
var tin = document.getElementById('in');
var cnvrt = document.getElementById('convert');
var out = document.getElementById('out');
var h = function h() {
out.value = '';
var obj = JSON.parse(tin.value);
for (var k in obj) {
out.value += "+ " + k + ": ";
out.value += obj[k] + "\n";
}
};
cnvrt.addEventListener('click', h);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment