Javascript examples for Object:Object Keys
Get all object keys using Object.keys()
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w ww . j a v a 2 s . c o m*/ var answers = {'a': 3,'b': 2,'c': 3, 'd': 1}; var keys = Object.keys(answers); var dupe = false; for(var i=0;i<keys.length;i++){ for(var j=i+1;j<keys.length;j++){ if(answers[keys[i]] === answers[keys[j]]){ dupe = true; break; } } if(dupe){ console.log("dupe value is there.."); break; } } } </script> </head> <body> </body> </html>