Error in project: Uncaught SyntaxError: Unexpected token var

1

I'm doing a console with javascript but I've had trouble figuring out the source of the error. I've reviewed the code several times and I have not been able to figure out what's wrong. Any help is appreciated.

var logStack = 0;
var showTime = false;
var currDate = new Date();
var i = 0;
var tempStr = "temp";

function getLogStr(var lineNum) {
	if(lineNum <= 10 & lineNum > 0) {
		return document.getELementById("line" + lineNum);
	} else {
		tempSTr = "Invalid line!";
		return tempStr;
	}
}

function setLogStr(var newLog, var line) {
	if(line <= 10 & line > 0) {
	document.getELementById("line" + line).innerHTML = newLog;
	} else {
		console.log("Invalid line!");
	}
}

function shiftLog(var line10) {

if(logStack == 10) {
	for(i = 1;i <= 10;i++) {
		setLogStr(i,getLogStr(i + 1));
	}
	setLogStr(10,line10);

} else {
	console.log("There are free lines!");
}
}



function logOnConsole(var newLog) {
currDate = Date();
	if(logStack == 10) {
		shiftLog(new Date().getHours());
	} else {
		setLogStr(newLog, logSTack + 1);
		logStack++;
	}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1" />
<title>Ice Console</title>
</head>
<body>
<div id="line1"></div>
<br />
<div id="line2"></div>
<br />
<div id="line3"></div>
<br />
<div id="line4"></div>
<br />
<div id="line5"></div>
<br />
<div id="line6"></div>
<br />
<div id="line7"></div>
<br />
<div id="line8"></div>
<br />
<div id="line9"></div>
<br />
<div id="line10"></div>
<br />
<input type="text" id="console" />
<input type="button" value="Run" />

</body>
</html>
    
asked by anonymous 18.02.2017 / 16:33

1 answer

2

Remove all% w / o of function arguments, this is wrong syntax in JavaScript.

That is, it changes var to function getLogStr(var lineNum) { .

These variables as function getLogStr(lineNum) { are declared by the function and are only available within the function (that is, they are limited to the scope of the function).

    
18.02.2017 / 16:41