You can connect javascript to solidity by using web3.. To know more visit: https://github.com/ethereum/wiki/wiki/JavaScript-API
you should use different syntax depending on whether the contract has already been deployed or not.. you can call the contract methods when you have contract instances:
const example = web3.eth.contract(abiArray);
const contractInstance = example.at(address);
contractInstance.declareWinner(winner, function (err, res) {
// do something
});