Skip to content

Instantly share code, notes, and snippets.

@stiekel
Created May 26, 2015 03:56
Show Gist options
  • Save stiekel/bdc8767106e26260c81e to your computer and use it in GitHub Desktop.
Save stiekel/bdc8767106e26260c81e to your computer and use it in GitHub Desktop.
细细领会一下这是个什么程序的代码
var contact = [
{ nickname: 'coco', mobile: '13151185930', gender: '女' },
{ nickname: 'F**k', mobile: '18651941714', gender: '女' }
];
var price = [
{ mobile: '13151185930', price: 1024 },
{ mobile: '18651941714', price: 1722 }
];
contact.forEach(function(c){
price.forEach(function(p){
if(c.mobile === p.mobile) {
c.price = p.price;
}
});
});
console.log('contact: ', contact);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment