5 Who's in your bracket HELP!


#1

Hi this is my code for the exercise:

var james = {
job: "programmer",
married: false
};

// set to the first property name of "james"
var aProperty = (james.job)

// print the value of the first property of "james"
// using the variable "aProperty"
console.log**(aProperty)**


it give the right output -> logging programmer into the console but i get the error "Oops, try again. Do you have the variable 'aProperty' between brackets?" but as seen in the code it is in brackets (in bold)

plz help me
thx


#2

Read again instructions. You were supposed to assign to the aProperty name of the first property - "job":

var aProperty = "job";

and now you have to print to the console value of this property using bracket notation.


#3

james[aProperty]; this is what i tried for the end but it says
Oops, try again. It looks like james' job was not logged to the console.
heres it in the whole code
var james = {
job: "programmer",
married: false
};

// set to the first property name of "james"
var aProperty = "job";

// print the value of the first property of "james"
// using the variable "aProperty"
james[aProperty];

any ideas
thx


#4

You have to print this value to the console. To print something we use console.log statements.


#5

thank you so much for the help it works now.


#6

Great! You're very welcome :slight_smile:


#7

I tried, it is not working. :smirk:

var james = {
    job: "programmer",
    married: false
};

// set to the first property name of "james"
var aProperty = "job";
//console.log(aProperty);

// print the value of the first property of "james" 
// using the variable "aProperty"
console.log(james[aProperty]);

Am I missing something?


#8

Doesn't look like it, it worked for me :slight_smile: , so try and run it again


#9

This is correct code. Please try to refresh, if it does not help you should:

  1. copy your code;
  2. click reset code;
  3. click save & submit code;
  4. paste your code back into the editor;
  5. click save & submit code again.

#10

Here is the code guys it's work

var james = {
job: "programmer",
married: false
};

// set to the first property name of "james"
var aProperty = "job";

// print the value of the first property of "james"
// using the variable "aProperty"
james[aProperty];
console.log(james[aProperty]); // my problem was that i add here more text in console, so put only this


#11

same problem here. Am I missing something?

var james = {
    job: "programmer",
    married: false
};

// set to the first property name of "james"
var aProperty = "job";

// print the value of the first property of "james" 
// using the variable "aProperty"
console.log(james[aProperty]);

#12

This code is correct. Did you tried to:

  1. copy your code;
  2. click reset code;
  3. click save & submit code;
  4. paste your code back into the editor;
  5. click save & submit code again.

?


#14

Reload the page and remove existed code and paste ur's correct code, hit submit it will work.


#15

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.