Unable to create array


#1

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


#2

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


#3

I was able to create one like this:

var my_array = [];

Try that and see if it works for you.


#4

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:


#5

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


#6

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!