var person = { "name": "John Doe", "age": 30, "email": "jdoe@example.com", "phone": "555-555-5555", "address": { "street": "123 Main St", "city": "Anytown", "state": "TX", "zip": "12345" } };
var selectedProperties = _.pick(person, "name", "age");
{ "name": "John Doe", "age": 30 }
var book = { "title": "The Catcher in the Rye", "author": "J.D. Salinger", "genre": "Literary Fiction", "pages": 277 };
var selectedProperties = _.pick(book, "title", "genre");
{ "title": "The Catcher in the Rye", "genre": "Literary Fiction" }The pick function is a part of the Underscore.js library.