I am getting products in JSON format and I want that my default product have a开发者_如何学Go MARK that I know that is default:
DisplayValue = "MARK";
How can I do it?
In javascript you can add a property to any object just by assigning a value:
var products = [{ Name: 'A' }, { Name: 'B' }, { Name: 'C' }];
$(products).each(function() {
this.DisplayValue = "MARK" + this.Name;
}
精彩评论