Tuesday, March 18, 2014

javascript object concepts

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys

http://stackoverflow.com/questions/921789/how-to-loop-through-javascript-object-literal-with-objects-as-members

http://stackoverflow.com/questions/7306669/how-to-get-all-properties-values-of-a-javascript-object-without-knowing-the-key

How to find the length of the object using javascript

<!DOCTYPE html>
<html>
<body>

<table>
    <tbody id="tbody"></tbody>
</table>

<script>
var obj = {    "key": "apple",    "value": 1.90};  
var a= Object.keys(obj).length;
document.write(a);

</script>

</body>
</html>

 output: 2