Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var obj ={
  name: "test",
  age:29,
  country: undefined,
  state: undefined  
};
for(var i=0,keys = Object.keys(obj),len=keys.length;i<len;i++){ 
  if(typeof obj[keys[i]] === 'undefined'){
    delete obj[keys[i]];
  }
}
console.log(obj);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
prabhuignotopro
0viewers