Skip to content

Instantly share code, notes, and snippets.

@vinicius5581
Created September 27, 2017 18:27
Show Gist options
  • Save vinicius5581/3b4a243d4bed703c73c9a138c8821b99 to your computer and use it in GitHub Desktop.
Save vinicius5581/3b4a243d4bed703c73c9a138c8821b99 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/lukavug
<!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">
function HashTable(obj){
this.length = 0;
this.items = {};
for (var p in obj) {
if (obj.hasOwnProperty(p)) {
this.items[p] = obj[p];
this.length++;
}
}
}
var a = new HashTable({ 'id':123, 'car': 'batido', testArray:[{'d':321},'aviao']});
console.log(a.length);
console.log(a.items);
</script>
<script id="jsbin-source-javascript" type="text/javascript">function HashTable(obj){
this.length = 0;
this.items = {};
for (var p in obj) {
if (obj.hasOwnProperty(p)) {
this.items[p] = obj[p];
this.length++;
}
}
}
var a = new HashTable({ 'id':123, 'car': 'batido', testArray:[{'d':321},'aviao']});
console.log(a.length);
console.log(a.items);</script></body>
</html>
function HashTable(obj){
this.length = 0;
this.items = {};
for (var p in obj) {
if (obj.hasOwnProperty(p)) {
this.items[p] = obj[p];
this.length++;
}
}
}
var a = new HashTable({ 'id':123, 'car': 'batido', testArray:[{'d':321},'aviao']});
console.log(a.length);
console.log(a.items);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment