Unable to create array

I don’t know if this is purposeful or not (maybe we shouldn’t be able to create data structures?), but I’m unable to create an array in both the “Gridmancer” and the “It’s a trap!” levels.

This is the line of code being used:
var mycars = new Array();

This is the error message:
TypeError: undefined is not a function

Also, the ability to create functions would be really useful for the “Gridmancer” level.

1 Like

I was able to create one like this:

var my_array = [];

Try that and see if it works for you.

1 Like

Also, with respect to functions, I was able to create them like this:

this.myFunction = function(arg1, arg2) {
    this.say('arg1: ' + arg1 + ', arg2: ' + arg2);
};

// try out your function
this.myFunction("arg1", "arg2");

Give that a shot. You’re right–without functions or arrays you are going to be very frustrated trying to complete gridmancer :smile:

1 Like

Thank you. I’ve never made anything in javascript before.

I see the problem and have added an issue over here: https://github.com/codecombat/aether/issues/3

Basically I think I just need to extend the Aether transpiler to realize that things like Array should be valid identifiers. It’s on my list.

Thanks for the bug report!