Guest User

Untitled

a guest
Oct 18th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. const getProperty = (obj, string) => {
  2. const array = string.split('.')
  3. let a = obj
  4. for(let i of array) {
  5. a = a[i]
  6. }
  7. return a
  8. }
  9.  
  10. console.log(getProperty(obj, 'a.b.c'))
Add Comment
Please, Sign In to add comment