fkling / jsbasics

An interactive introduction to basic and important concepts of JavaScript
14 stars 11 forks source link

11 exercise does not seem to work as expected #3

Closed vamsipavanmahesh closed 9 years ago

vamsipavanmahesh commented 9 years ago

Here is my code var obj = { foo: "bar", arr: [1,2,42]

} log(obj.foo,obj.arr) in the code editor .......................................................................


var obj = { foo: "bar", arr: [1,2,42]

};

console.log(obj.arr); console.log(obj.foo);

This seems to work fine in the console

fkling commented 9 years ago

Sorry for the late response, I didn't get a notification for this issue.


I still have to add solutions to the exercises. The assignment reads:

Log two value: an object which has a property foo and a value "bar", and an array with the values 1, 2 and 42.

While you are logging two values, you are logging the string "foo" (wrong) and the array [1,2,3] (correct).

So the solution should be:

var obj = {foo: 'bar'};
var arr = [1,2,3];
log(obj, arr);

(or similar)