Created
September 27, 2017 18:27
-
-
Save vinicius5581/3b4a243d4bed703c73c9a138c8821b99 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/lukavug
This file contains hidden or 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"> | |
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> |
This file contains hidden or 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
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