Javascript examples for Object:Object Literal
Loop and iterate through key value pair from object literal
<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 2s . c o m*/ var myObj = { style: "test", origin: "Thailand", day: "18d", color: "", abc: "", def: undefined, weight: null } for(var keys in myObj){ if(myObj[keys] ===null || myObj[keys] == ""){ delete myObj[keys] } } console.log(myObj) } </script> </head> <body> </body> </html>