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 trialRonald Greer
Front End Web Development Techdegree Graduate 56,430 PointsI am in big pickle
i really do not understand whats going on here. can someone please send an example?
var firstName;
firstName = "Kylo";
var lastName;
lastName = "Ren";
var fullName = "message";
message += "Kylo Ren";
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
2 Answers
victor cooper
6,436 Pointsfirst line you declare a variable, second line you assign a value to it. third and fourth line do the same. fifth line you declare a variable and assign a value to it. last line will give you an error because you are trying to concatenate an undefined variable with a string.
Ronald Greer
Front End Web Development Techdegree Graduate 56,430 Pointscan you show me an example please?
Manuel Bichler
Courses Plus Student 876 PointsManuel Bichler
Courses Plus Student 876 PointsWhen the browser starts it will go threw the index.html file. It sees that you have linked to a
<script src="script.js"></script>
file and he will check that too.In the script.js file you have defined 3 variables which the browser keeps in mind. He kind of stores them. If you open your developer console in the browser (right click and inspect) you can check the variables. But first you need to tell the browser that you also want to see it in the console. You do that with console.log(variable);
So if you add at the bottom of your script.js the line
you will actually see what the browser has stored in the variables.... hope it helps.