I'm calling makeALine
function inside of lines
function.
And I a trying to save line in makeALine
function, using this
keyword.
But it says this
is undefined
.
I have no idea why it is undefined
.
Anyone help?
function makeALine(setOfDots) {
let line = {
model: new makerjs.paths.Line(setOfDots)
}
console.log(this) //undefined
this.paths = line;
}
function lines(obj) {
for (let [key, value] of Object.entries(obj)) {
console.log('value', value)
let lineType = key.includes(LINE) ? makeALine(value) : null;
lineTypes.push(lineType)
}
console.log(lineTypes)
}