In var foo = { name: 'kevin'}; You store an object or a dictionary to that variable... which is now a key-value pair... so you can access the value of an object using the key...
since its a key value pair... you can't access it using '.' operator... because foo is not a class... type of foo will be a dictionary or object...
so, to access the value you need to use the [] paranthesis...