Problem
I have tried looking at the other solutions here but nothing is seeming to work for me. My problem is that I'm getting an unexpected var token on line 43, but I can't find any unclosed brackets or parentheses. I've tried deleting line by line, but the problem only starts on that line. If I delete line 43 the line above it has an unexpected ")" token and I can't figure that one out either. This is the code
CODE
// FUNCTION DEFINITION(S)
function map(array, callbackFunction) {
var newArray = [];
for (var i = 0; i < array.length; i++) {
newArray = newArray + callbackFunction(element);
}
return newArray;
}
function cubeAll(numbers) {
return map(numbers, function(n) {
return n * n * n;
});
}
// ASSERTION FUNCTION(S) TO BE USED
function assertArraysEqual (actual, expected, testName) {
var allValuesAreEqual = true
for (x = 0; x < actual.length; x++) {
var actualValues = actual[x];
var expectedValues = expected[x];
if (actualvalues !== expectedValues) {
allValuesAreEqual = false
break;
}
}
if (allValuesAreEqual === true) {
console.log('passed')
} else {
console.log ('FAILED [' + testName + '] expected ' + expected + ', but got ' + actual + '.')
}
}
// TESTS CASES
var numbers = [2, 3, 4];
var output = function cubeAll(numbers)
var actual = function map(output, cubeAll)
var output = function cubeAll(numbers)? That's not how you call a function, it's justvar output = cubeAll(numbers)