Reputation: 1
Just a side note before you try to help: I am a complete newbie. Try to keep things simple ;) I am trying to code a way to store var values between webpages in HTML. So far I have not been very successful. The problem I am having at the moment is the error 'unexpected token, ';'' (when I paste it into the console on 'Ctrl+Shft+J'
var cookieString = document.cookie;
var savedStats = 0;
var stats = 0;
var fsStat = 0;
var psStat = 0;
var testStat = 0;
function getStats() {
function splitCookieString() {
return savedStats = cookieString.split(',');
}
return stats = [savedstats[0], savedStats[savedstats.length - 1];
return fsStat += stats[0];
return psStat += stats[1];
return testStat = 'Hello World!';
}
}
and it points to the end of the line:
return stats = [savedstats[0], savedStats[savedstats.length -1];
Please help me! Also while I'm here, the Function 'getStats()' has a wierd thing going on where it makes me put two '}' to end it.
Upvotes: 0
Views: 101
Reputation: 2154
The code you posted shows some problems around the understanding of:
The return
keyword (structured programming)
The assignment operator (=
) (imperative programming)
I strongly recommend to develop some understanding of these concepts.
Upvotes: 1