var myDog = {
// Only change code below this line
name:Luna
legs:5
tail:6
freinds:[]
// Only change code above this line
};
does anyone know why e name is undefined
var myDog = {
// Only change code below this line
name:Luna
legs:5
tail:6
freinds:[]
// Only change code above this line
};
does anyone know why e name is undefined
JavaScript thinks Luna
is a variable and since there is no variable named Luna
defined, you get undefined
. You can wrap it in quotes, so that Luna
is a string and that would avoid the problem.
I would suggest searching for javascript object literal syntax and compare that with your code here.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).