Never put space between ```function``` or function name and parenthesis. So here ```function (``` should not be a space, remove it.
But here ```(){``` always should be space. Ideally it should look like this: ```createPalette : function() {```