I'm attempting to create a new array var class = []
based off an array of arrays and comparing the indices within those. when i run the test it's telling me that the = in the var class = []
is a syntax error. Not sure exactly what i'm doing wrong.
function list(names) {
var class = [];
var array = names.map(function(obj) {
for (var i = 0; i < obj.length; i++) {
if (obj[0] > 55 && obj[1] > 7) {
class.push("Name1")
} else {
class.push("Name2")
}
return class;
}
});
};
console.log(
list([
[18, 20],
[45, 2],
[61, 12],
[37, 6],
[21, 21],
[78, 9]
])
)