Refactored compare.js to use a makeshift 'spaceship' operator, simplified sendAction in component.js

to follow coding conventions
```js
function spaceship(a, b) {
   // ..
}
```