Lost Viking - Line 49 : tmp67[tmp68] is not a function?

Is it that I am not allowed to write functions in this level or I am not writing or defining them correctly?

Source Code:

// You MUST click on the HELP button to see a detailed description of this level!

// The raven will tell you what to use for your maze parameters!
var SLIDE = 10;
var SWITCH = 7;
var SKIP = 11;

// How many sideSteps north of the Red X you've taken.
var sideSteps = 1;

// How many steps east of the Red X you've taken.
var steps = 1;

// Multiply this with steps to determine your X coordinate. DON'T CHANGE THIS!
var X_PACE_LENGTH = 4;

// Multiply this with sideSteps to determine your Y coordinate. DON'T CHANGE THIS!
var Y_PACE_LENGTH = 6;

var modSWITCH = (steps - 1) % SWITCH;
var modSKIP = (steps - 1) % SKIP;


var normal = function () {
    this.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
    steps++;
    sideSteps++;    
};

var Switch = function () {
    sideSteps--;
    this.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
    steps++;
};

var Skip = function () {
    sideSteps -= 2;
    this.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
    steps++;
};

var Slide = function () {
    if (sideSteps >= 10) {
        sideSteps = 1;
        this.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
        steps++;
    } else if (sideSteps <= 1) {
        sideSteps = 10;
        this.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH); // error occurs here
        steps++;
    }
};

// The maze is 35 steps along the X axis.
while(steps <= 35) {
    if (modSWITCH === 0 && this.pos.x > 6) {
        Switch();
    } else if (modSKIP === 0 && this.pos.x > 6) {
        Skip();
    } else {
        Slide();
        normal();
    }
}

The this inside your functions isn’t the same this as in the global scope.

You have a couple of options here:

  1. Use Function#call to call your function with the global this

    fn.call(this, ...arguments)
    
  2. Define functions on the this keyword

    this.fn = function (...args) { /* ... */ }`
    
  3. Define a _this (or that or self or me) outside the function, then use that inside the function

    var _this = this
    function fn (...args) { _this.doSomething(); /* ... */ }
    

Though in Lost Viking there isn’t really a need to create any functions; it’s really just a bunch of variable assignments.