I hate these objects still get stuck every step i do


#1

as keys/ properties always if we have 2/more words for making the property we need to input quotations?
I mean for example this syntax error for this code appear just because I didn't input quotations for graduation year

var anObj = {
    studies: "oil & gas engineering bachelor degree",
    graduation year: 2015
}
var myArray =[3, 34 > 2, "looking for job", anObj];

and if we have a word we can just input it without any special charaters(I refer to quotations)


#2

space is not allowed in variable names. use graduationYear or graduation_year


#3

I just used double quotations for passing the waypoint
oh, graduation year' is also a variable so these keys are also variable?


#4

Like so?

var anObj = {
    studies: "oil & gas engineering bachelor degree",
    "graduation year": 2015
}

I guess that works too. You won't be able to access it with dot notation then though. But perhaps that's not what you want. I would change studies to a string literal as well, for consistencey


#5

you mean I must replaced it with graduation_year?


#6

Depends on what you're looking to do. Do you want to treat it like a dicitionary with keys and values, or an object with properties?


#7

object with property i think must be the purpose of this kind of code


#8

So then you wouldn't be able to have the space, because this:

anObj.graduation year

Is two separate names due to the space


#9

i have one more question 'dot method is just for variable?


#10

They're equivalent, but the space can't be used with dot notation


#11

ok thx so much for feedback!