Skip to content

Added all HW Responses #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

miguerurso
Copy link

Week 1 HW Submission

Please fill out the information below in order to complete your assignment. Feel free to update this comment later if necessary.

  • Comfort rating on this assignment (1-5): 1|2|3|4|5
  • Completion rating on this assignment: complete|incomplete


console.log('First name: ' + firstName + '\nLast name: ' + lastName + '\nEmail: ' + email + '\nPhone number: ' + phone + '\n');
console.log(`First name:${firstName}\nLast name:${lastName}\nEmail:${email}\nPhone number:${phone}\n' `);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Template literal looks good.

@@ -1,11 +1,23 @@
import people from './people.json';

const{name, email, phone} = person;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

person is out of scope here, so this will cause an error because the variable is not defined.

// const phone = person.phone;

// console.log('First name: ' + firstName + '\nLast name: ' + lastName + '\nEmail: ' + email + '\nPhone number: ' + phone + '\n');
// });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get this working, you can just use this code + replace the console.log line with your correct template literal version. Then make the following changes:

  1. Since names is an array, you can destructure the first/last names like this: const [ firstName, lastName ] = person.name.split(' ');
  2. Since email and phone are properties being pulled out of the person object, they can be destructured as well, like this: const { email, phone} = person;.

Hopefully that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants