HTML and CSS Reference
In-Depth Information
Engage thrusters
Follow the given steps to create the sushi:
1. We need a funcion to compare two given arrays. The array is in one dimension only
so we don't need any deep comparison. Put the following comparing funcion in the
helpers.js file:
game.helper.arrayIsEqual = function(array1, array2) {
if (array1.length !== array2.length) {
return false;
for (var i = 0, len=array1.length; i < len; i++) {
if (array1[i] !== array2[i]) {
return false;
return true;
2. Then we need another helper funcion that clears all the children nodes inside a
given DOM element. Deining the following funcion inside the helpers.js file,
helps us to keep a cleaner code base:
game.helper.clearChildren = function(node) {
while (node.lastChild) {
3. We use three layers to represent the ingredients in the sushi board. We define the
method that clears all the nodes inside the three layers defined as follows:
game.view.clearAllIngredients = function() {
4. In the data.js file, we store the selected ingredients in a list of array:
game.sushiOnHand = [];
Search WWH ::

Custom Search