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 trialGeorge Nono
11,256 PointsWhat am I doing wrong?
Hi
I don't know what I'm doing wrong here, please help thanks!
var person = {
name: 'Sarah',
country: 'US',
age: ,
treehouseStudent: true,
skills: ['JavaScript', 'HTML', 'CSS']
};
function print(message) {
var div = document.getElementById('output');
div.innerHTML = message;
}
var message = '<p>Hello my name is ' + person.name + '</p>';
print(message);
4 Answers
George Nono
11,256 PointsI'm sorry it was there I deleted it, I just put the age back and it's still not working. What is my HTML supposed to look like?
I have this :
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> </head> <body>
<div id="innerHTML">
</div> <script src="scripts.js"></script>
</body> </html>
Paolo Villanueva
7,654 PointsLooks like you're missing an integer for your age property. You can't just leave it blank.
Angy Android
Courses Plus Student 62 Pointsvar person = {
name: 'Sarah',
country: 'US',
age: 18,
treehouseStudent: true,
skills: [
'JavaScript',
'HTML',
'CSS'
] };
function print(message) {
var div = document.getElementById('output');
div.innerHTML = message;
}
var message = 'Hello my name is ' + person.name;
print(message);
Paolo Villanueva
7,654 PointsIf you're doing this on a notepad and you wanna see it print out. Make sure you have a div tag with an "output" id and link to your js file.
or do this:
<!DOCTYPE html> <html> <head> </head> <body> <div id="output"></div>
<script script language="javascript" type="text/javascript">
var person = {
name: 'Sarah',
country: 'US',
age: 11,
treehouseStudent: true,
skills: ['JavaScript', 'HTML', 'CSS']
}
function print(message) {
var div = document.getElementById('output');
div.innerHTML = message;
}
var message = '<p>Hello my name is ' + person.name + '</p>';
print(message);
</script>
</body>
</html>
Chyno Deluxe
16,936 PointsChyno Deluxe
16,936 Points//Fixed Code Presentation