Question: Having issues comparing in my check_password() function. It keeps giving me a missing ; after for loop initializer. JAVASCRIPT function LinkedList() { this.head = null;
Having issues comparing in my check_password() function. It keeps giving me a missing ; after for loop initializer.
JAVASCRIPT
function LinkedList() { this.head = null; this.tail = null; this.length = 0; }
function Node(item) { this.next = null; this.prev = null; this.item = item; }
LinkedList.prototype.add = function(_data) { var node = new Node(); node.item = _data if (!this.head) { this.head = node; this.tail = node; } else { node.previous = this.tail; this.tail.next = node; this.tail = node; } this.numberOfValues++; }
function simpleHash(str) { len = str.length; hash = 0; for (i = 1; i <= len; i++) { char = str.charCodeAt((i - 1)); hash += char * Math.pow(31, (len - i)); hash = hash & hash; } return hash; }
var list = new LinkedList();
function add_password() { var c = document.getElementById("passInput").value; c = simpleHash(c); list.add(c); list.length++; console.log(c); }
function check_password(_data) { var check = document.getElementById("chkPass").value; check = simpleHash(check); console.log(check); var len = _data.length; for(var i =0, i < len, i++){ if (check != list){ console.log("Error incorrect password"); } else{ console.log("Successful login attempt") } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
