Need serious help here


#1

I have tried the code several different ways and I have no idea what I'm doing here. The example in the assignment is so vague, it's useless. Could someone please tell me what I'm missing or have completely incorrect.

Thanks,


var newArray= [];
var newArray = [2,3.4];
var newArray = [5,6];
var myObj = {type:'fancy', disposition: 'sunny'};

newArray = [[2,3,4],[5,6], myObj];
console.log(newArray, myObj);


#2

What is the purpose of the var keyword?


#3

I don't know, I have just been trying different combos to see what works. This is all new to me, so if you can help out that would be greatly appreciated.

Thanks,


#4

Do you understand scope?


#5

Maybe, how does that apply here? I just need to know what is the right format for writing multidimensional arrays with an object. That's what is not clear to me.

Thanks


#6

If you do not understand var and you do not understand scope then it will be hard to answer this question with anything more detailed than a direct solution, which is counter productive to learning and does not work. There is just too much to remember. We HAVE to understand.


#7

Hi, thanks for your help, I did figure it out eventually. I am new to coding, so I have no background knowledge to draw on for this right now. I'm learning as I go. Hope you remember those early days when you were first learning to code.
Just seen a lot of different approaches to the assignments and I'm trying to figure out the patterns. I'm a conceptual and sequential learner. I just need some real guidance and consistency as I develop this new skill.

Thanks again, have a nice evening.

Best regards,
CA Cruz, Ed. D.


#8

But can you answer my earlier questions? If not, then stop. Stop right now and find the answers. Don't go forward until then. And while you're at, add execution context to the list. Seriously, if you want to learn this, then don't skip this step.

What is the purpose of the var keyword?

Do you understand scope?


#10

First of all it would be helpful if you could give some more information about the problem e.g. link or quote the task, especially if you want to complain about it calling it vague and useless. Also giving the error message might be useful as well. At the very least mention the actual exercise number this belongs to or a short description of what you want it to do and what it actually does.

var newArray= [];
var newArray = [2,3.4];
var newArray = [5,6];

Here you create the same variable 3 times with different values. That is pretty pointless and rather indicates that there is a conceptual problem and not just a bug to be fixed.

I don't know, I have just been trying different combos to see what works.

That again pretty much implies that you should rather take a break and focus on the basics, because adding random vars is not even close to help you with multidimensional array. So if this is your problem solving mechanism then you should really review your toolkit of options and to help you understand the use of var the keyword is as @mtf already mentioned: scope and you should rather take a step back and review it because there is little use advancing if you're just poking around in the dark, is it?


#11

Thank you for your feedback


#12

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