[英]Compiler like to point bugs for Javascript
I am somewhat of a beginner with JS but it occured to me that it would be nice to have a compiler like thingy that shows where the errors are (though its an interpreted language) - i am currently using Webstorm without any customizations but as far as i can tell its not pointing to obvious errors. 我有点像JS的初学者,但是对我来说,拥有一个像whaty这样的编译器来显示错误的位置(尽管它是一种解释语言)会很好-我目前正在使用Webstorm,但没有进行任何自定义,但是我可以告诉它没有指出明显的错误。 For example if i have an opening brace and not a closing brace; 例如,如果我有一个大括号而不是一个大括号; or an extra closing brace - a compiler would point to that fact; 或额外的括号-编译器将指出这一事实; i am sure JS has some eqivalent way - isnt there? 我确定JS有某种等效的方式-不是吗?
<script>
var switchDirection = false;
function doAnimation(){
var divAdvert = document.getElementById("divAdvert");
var currentLeft = divAdvert.offsetLeft;
var newLocation;
if(!switchDirection) {
newLocation = currentLeft + 2;
if (currentLeft >= 400) {
switchDirection = true;
}
}else{
newLocation = currentLeft -2;
if(currentleft <=0){
switchDirection = false;
}
}
divAdvert.style.left = newLocation + "px";
}
} // extra closing brace hard to find; why isnt there a compiler like thing to show where errors are for JS?
Here are some of your options: 以下是您的一些选择:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.