我通过阅读 Eloquent JavaScript 来学习 JavaScript。我在本书网站提供的控制台上运行我的代码。我SyntaxError : Unexpect Identifier
从以下代码中得到一个。请帮忙。
function absolute (n){
if (n < 0)
return -n;
else
return n;
}
function average(x, y){
return (x + y) / 2;
}
function isGoodEnough(x, guess){
return (absolute(x - guess) < 0.0001);
}
function maybe(x, guess){
if isGoodenough(x, guess){
return guess;
}
else{
return maybe(x, average(x, x/guess));
}
}
function sqrt(x){
return maybe(x, 1);
}