Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- data: {
- info: {
- user: {
- name: "Hercules",
- password: "Iamthegreatest!"
- email: "hercules@olymp.gr"
- }
- }
- }
- }
- if (data && data.info && data.info.user && data.info.user.email) {
- var email = data.info.user.email;
- }
- if (data.info.user.email)
- // do something
- }
- let data = {
- info: {
- user: {
- email: 'user.email@example.com'
- }
- }
- }
- _.get(data, 'info.user.email');
- // => 'user.email@example.com'
- _.get(data, 'info.user.emailAddress', 'default.email@example.com');
- // => 'default.email@example.com'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement