Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Can someone help with this?

Write an if statement that checks whether there are any skills in the bio object. If the if statement evaluates to true, . append() HTMLskillsStart to the div with id=header. Then .append() the skills to the element with id=skills using HTMLskills to format each skill.

Here is the object if that helps: var bio = { "bio": [{ "name": "Gary", "role": "Web Developer", "contact": [{ "mobile": 5555555555, "email": "garyterellchristie@gmail.com", "github": "GChristie1" "location": "Orlando, FL", "facebook": "GaryTerellChristie" }], "picture": "..images/fry.jpg", "welcomeMessage": "Hey there", "skills": ["Web Developer", "License Insurance Agent", "Fast Typer", "Bishop"] }] };

1 Answer

Steven Parker
Steven Parker
216,121 Points

A link to the course video or challenge would be helpful. Unless the link points to Udacity. :stuck_out_tongue:

This can't be complete since I don't have the API for HTMLskills. But I can give you a few hints:

This object is deeply nested and contains arrays. Just to count them, you'd need a loop, something like this:

var total = 0
for (n in bio.bio)
  total += bio.bio[n].skills.length;

Then you could test total.

Then to select "div with id=header" you'd use $("div.header") (you're using JQuery, right)? And "the element with id=skills" is just $("#skills").

I hope that'll get you going.