16/17. Need some assistance


#1

Hi. I'm getting an error message for the below code:
var myInterests: ['music', 'running', 'praying'];

var myObject = {
name: 'Eduardo',
type: 'Most excellent',
interests: myInterests
};

The error message states: "SyntaxError: Expected ';'"


#2

Line 1, compare to
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Assignment

Also, running the code in a different interpreter, such as in your browser or an online interpreter, would get you a line number with error messages, which tells you where it could no longer make sense of your code.


#3

we have to add value of array to interests key of object. so i created one array and one object. below is my code.

var myArray = ["eat", "sing", "sleep"];

var myObject = {
name: 'Eduardo',
type: 'Most excellent',
interests: myArray[1],
};

BUT I am getting error "Oops, try again. Did you give your interests key an array value?"


#4

Here's the code I put in and I ended up getting "Way to Go!'

var myObject = {
name: 'Eduardo',
type: 'Most excellent',
interests: [16]
};

var newArray = [16];


#5

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