JavaScript - Unexpected identifier for loop

后端 未结 2 992
时光取名叫无心
时光取名叫无心 2021-01-29 13:34

I am trying to write a kind of brute force script in javascript! This is what I have so far:

var charset = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\         


        
相关标签:
2条回答
  • 2021-01-29 13:40

    Length is spelt wrong in your for loop. It should be length not lenght.

    0 讨论(0)
  • 2021-01-29 13:41

    for(int i = 0; i < charset.lenght; i++){

    should be for(var i = 0; i < charset.length; i++){

    Also inline event handlers like <input onClick = "bruteForce()" name="input" type="image" src="arrow.jpg" align="right" /> expect the handler to be in global scope.

    So if the code you shared is enclosed in some other wrapper function, it probably won't work. Otherwise it's the first syntax error causing the second as well...

    0 讨论(0)
提交回复
热议问题