Uncaught SyntaxError: missing ) after argument list - and I can't see where

Uncaught SyntaxError: missing ) after argument list - and I can't see where

我在制作小费计算器时出现错误

function CalcTip(){
var bill = document.querySelector('#bill').value;
var people = document.querySelector('#people').value;
var button = document.querySelector('button');
var total = bill.value/people.value;                 
document.getElementById("#last").innerHTML = "$" + total;  
total = Math.round(total * 100) / 100;

}          

button.addEventListener('click',函数(){} calcTip(); );

错误在你的addEventListener上,应该是

button.addEventListener('click', calcTip);

您的代码中有几个错误。

这是一个功能示例:

var button = document.getElementById("calculate");
button.addEventListener('click', CalcTip);

function CalcTip(){
  var bill = document.getElementById('bill');
  var people = document.getElementById('people');  
  var total = parseInt(bill.value) / parseInt(people.value);                 
  total = Math.round(total * 100) / 100;
  
  document.getElementById("last").innerHTML = "$" + total;
}
<button type="button" id="calculate">Calc Tip</button><br>

<input type="text" id="bill"><br>
<input type="text" id="people">this can't be 0<br>

<div id="last"></div>