Editing an existing object Arrays and Objects in JS


#1

var myObject = {
name: 'Eduardo',
type: 'Most excellent',
// Add your code here!
interests:weArose,
};
var weArose=[["bbc","ddc"],[34,78]];

these codes are ok
but before ,i did as this :

var myObject = {
name: 'Eduardo',
type: 'Most excellent',
// Add your code here!
interests:"weArose"
};
var weArose=[["bbc","ddc"],[34,78]];

why interests:"weArose" is not ok?

thanks


#2

Hi @vin5460 :smiley:
The reason why the "weArose" as a string can't work is because you are defining that later as a variable that stores an array. A variable signature can't be a data type.

Hope this helps!


#3

hi ,thank you for your reply .thanks


#4

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