Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
229,644 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.