0

want to Modify the displayBirthdate function to display a user’s age from the API call in getAUserProfile() in a DIV with a CSS

var displayBirthdate = ({dob}) => { document.querySelector('.details').textContent = dob.age + 'years old'; }; var displayAddress = ({location = 'location'}) => {}; var displayPhone = ({phone = 'phone', cell = 'cell'}) =>{}; const displayExtraUserInfo = (param) => { document.querySelector('#btn-birthdate').addEventListener('click', () => { displayBirthdate(param); }); document.querySelector('#btn-phone').addEventListener('click', () => { displayPhone(param); }); document.querySelector('#btn-address').addEventListener('click', () => { displayAddress(param); }); }; const notify = (msg) => { const toastr = document.querySelector('.messages'); if(!toastr) return; toastr.textContent = msg; if(!toastr.classList.contains('on')) { toastr.classList.add('on'); } };

9th Apr 2019, 6:27 PM
shadrach esharive
shadrach esharive - avatar
1 ответ
0
want to Modify the displayBirthdate function to display a user’s age from the API call in getAUserProfile() in a DIV with a CSS class ofdetails. The parameters in displayBirthdate must use destructuring, so I need to extract the age from the object. This is for a challenge I am trying, I have solved 4/5 and I am just stuck here, any ideas ad hits will be useful This is my code arameter and extract a specific property JavaScript 1 / 2   cornzie 27d Hi everyone, I am very new to JS. I want to Modify the displayBirthdate function to display a user’s age from the API call in getAUserProfile() in a DIV with a CSS class ofdetails. The parameters in displayBirthdate must use destructuring, so I need to extract the age from the object. This is for a challenge I am trying, I have solved 4/5 and I am just stuck here, any ideas ad hits will be useful var displayBirthdate = ({dob}) => { document.querySelector('.details').textContent = dob.age + 'years old'; }; var displayAddress = ({location = 'location'})
9th Apr 2019, 6:30 PM
shadrach esharive
shadrach esharive - avatar