I have multiple problems but my first is that my code returns an error:
"Uncaught TypeError: p1 is undefined".
var domino_array = ['ZeroZero', 'ZeroTwo', 'ZeroThree', 'ZeroFour', 'ZeroFive', 'ZeroSix', 'OneZero', 'OneOne', 'OneTwo', 'OneThree', 'OneFour', 'OneFive', 'OneSix', 'TwoTwo', 'TwoThree', 'TwoSix', 'ThreeThree', 'ThreeSix', 'FourTwo', 'FourThree', 'FourFour', 'FourSix', 'FiveTwo', 'FiveThree', 'FiveFour', 'FiveFive', 'FiveSix', 'SixSix'];
var realDomino = [];
// function double(a, b){ if(a === b) { return true;} else if (a !== b) { return false;} }
var Isdouble = function(p1, p2) {
return p1.localeCompare(p2);
}
for (let x = 0; x < domino_array.length; x++) {
var domino_die = {
die: this.domino_array[x],
TopDie: this.domino_array[x].split(/(?=[A-Z])/)[0],
BottomDie: this.domino_array[x].split(/(?=[A-Z])/)[1],
SpriteName: this.domino_array[x],
Double: Isdouble(this.TopDie, this.BottomDie)
};
realDomino[x] = this.Object.create(domino_die);
}
The JavaScript examples I find seem to be too advanced for me.