[英]Error: missing ; before statement in javascript
I am applying a javascript, but it fires the error: 我正在应用JavaScript,但是会引发错误:
**missing ; before statement**
String str = document.location.href;
alert(str);
str.replace( "/blogs/-/blogs", "blogs" );
Your any suggestions are appreciated. 您的任何建议表示赞赏。
Change 更改
String str = document.location.href;
to 至
var str = document.location.href;
You don't declare variables with a type in JavaScript but with the var
keyword. 您不用JavaScript声明类型的变量,而是使用
var
关键字声明。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.