Javascript examples for Array Operation:Array of Object
function to remove object properties from an array of objects
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w .j av a 2 s . c o m*/ var my = function (listObj,key) { for (var i = 0;i < listObj.length; i++) { for(var k in listObj[i]) if (k!=key) { delete listObj[i][k]; } } return listObj; } console.log(JSON.stringify(my([{a: 'b', c:'d'}, {a: 'q'}], 'a'))); } </script> </head> <body> </body> </html>