I’ve completed the challenge but I don’t understand where the console values (gift: “pony”, pet: “kitten”) are stored? I always write the code in my code editor when I’m finished, but I don’t know how to do that with this?
This is my code but its very basic and is not a function. How would I make this into a function?
Not quite. You need to remember, JavaScript is case sensitive. Also, the names you have chose for your function parameters are not ideal, because objects other than myDog could be passed to the function, and properties other than name could also be passed.
To use the checkObj function on the myDog object you have created, it would look like:
Right. Now this is the difference between a string and a variable:
var myString = "I am a string";
myString is the variable, but "I am a string" is a string. myString has a value of "I am a string".
Values are passed to functions as arguments:
myFunc(myString); // This works
myFunc("I am a string"); // This also works
Parameters are variables, and come from function arguments:
function myFunc(someVariable) {...} // This works: You can use someVariable within myFunc
function myFunc("I am a string") {...} // This does not work: cannot be used within myFunc
As you go further through the JS course, this will make more and more sense.