Errors in Setting JavaScript Cookies

I am placing a cookie to stop showing an offensive jokes warning alert if someone has already seen it but Adobe Brackets is showing 51 problems and 1 error and my JavaScript is not up to scratch. Don’t worry the cookie will not be used in identifying users and I have a cookie policy showing.

code below is there any way I can clear the error and problems. I have placed 100% of the code and the errors Brackets had identified following this.

Error is ESLint terminated with error:timeout

function writeCookie(name, value, hours) 
{}
function readCookie(name)
{}
function alert1()
{}

function writeCookie(name, value, hours)
{
    var expire = ""; 
    if(hours != null)
    {
        expire = new Date((new Date()).getTime() + hours * 3600000);
        expire = "; expires=" + expire.toGMTString();
    }
    document.cookie = name + "=" + escape(value) + expire;
}

function readCookie(name)
{
    var cookieValue,offset = "";
    var search = name + "=";
    if(document.cookie.length > 0)
    { 
        offset = document.cookie.indexOf(search);
        if (offset != -1)
        {
            offset += search.length;
            end = document.cookie.indexOf(";", offset);
            if (end == -1) end = document.cookie.length;
            cookieValue = unescape(document.cookie.substring(offset, end))
        }
    }
    return cookieValue;
}

function alert1()
{
    var seen = readCookie("viewed"); 
    if(seen !== "yes") 
    { 
        if(confirm("***WARNING*** n Some of these jokes MAY be offensive. n  n If you do not wish to be offended n Please Press Cancel to return n Please note this will place a cookie on your computer"))
        {
            writeCookie("viewed", "yes", 9999); 
        }
        else 
        {
            window.location="index.htm" 
        }
    }
}

Problems as per brackets

1
Unexpected ‘(space)’. function writeCookie(name, value, hours)
2
Expected exactly one space between ‘)’ and ‘{‘. {}
2
Expected ‘{‘ at column 5, not column 1. {}
2
Missing ‘use strict’ statement. {}
4
Expected exactly one space between ‘)’ and ‘{‘. {}
4
Expected ‘{‘ at column 5, not column 1. {}
4
Missing ‘use strict’ statement. {}
6
Expected exactly one space between ‘)’ and ‘{‘. {}
6
Expected ‘{‘ at column 5, not column 1. {}
6
Missing ‘use strict’ statement. {}
9
Expected exactly one space between ‘)’ and ‘{‘. {
9
Expected ‘{‘ at column 5, not column 1. {
10
Missing ‘use strict’ statement. var expire = “”;
10
Expected ‘var’ at column 9, not column 5. var expire = “”;
10
Unexpected ‘(space)’. var expire = “”;
11
Expected ‘if’ at column 9, not column 5. if(hours != null)
11
Expected exactly one space between ‘if’ and ‘(‘. if(hours != null)
11
Expected ‘!==’ and instead saw ‘!=’. if(hours != null)
12
Expected exactly one space between ‘)’ and ‘{‘. {
12
Expected ‘{‘ at column 13, not column 5. {
13
Expected ‘expire’ at column 17, not column 9. expire = new Date((new Date()).getTime() + hours * 3600000);
14
Expected ‘expire’ at column 17, not column 9. expire = “; expires=” + expire.toGMTString();
15
Expected ‘}’ at column 13, not column 5. }
16
Expected ‘document’ at column 9, not column 5. document.cookie = name + “=” + escape(value) + expire;
16
‘escape’ was used before it was defined. document.cookie = name + “=” + escape(value) + expire;
17
Expected ‘}’ at column 5, not column 1. }
20
Expected exactly one space between ‘)’ and ‘{‘. {
20
Expected ‘{‘ at column 5, not column 1. {
21
Missing ‘use strict’ statement. var cookieValue,offset = “”;
21
Expected ‘var’ at column 9, not column 5. var cookieValue,offset = “”;
21
Missing space between ‘,’ and ‘offset’. var cookieValue,offset = “”;
21
Missing space between ‘,’ and ‘offset’. var cookieValue,offset = “”;
22
Expected ‘var’ at column 9, not column 5. var search = name + “=”;
22
Combine this with the previous ‘var’ statement. var search = name + “=”;
23
Expected ‘if’ at column 9, not column 5. if(document.cookie.length > 0)
23
Expected exactly one space between ‘if’ and ‘(‘. if(document.cookie.length > 0)
24
Expected exactly one space between ‘)’ and ‘{‘. {
24
Expected ‘{‘ at column 13, not column 5. {
24
Unexpected ‘(space)’. {
25
Expected ‘offset’ at column 17, not column 9. offset = document.cookie.indexOf(search);
26
Expected ‘if’ at column 17, not column 9. if (offset != -1)
26
Expected ‘!==’ and instead saw ‘!=’. if (offset != -1)
27
Expected exactly one space between ‘)’ and ‘{‘. {
27
Expected ‘{‘ at column 21, not column 9. {
28
Expected ‘offset’ at column 25, not column 13. offset += search.length;
29
Expected ‘end’ at column 25, not column 13. end = document.cookie.indexOf(“;”, offset);
29
‘end’ was used before it was defined. end = document.cookie.indexOf(“;”, offset);
30
Expected ‘if’ at column 25, not column 13. if (end == -1) end = document.cookie.length;
30
Expected ‘===’ and instead saw ‘==’. if (end == -1) end = document.cookie.length;
30
Expected ‘{‘ and instead saw ‘end’. if (end == -1) end = document.cookie.length;
30
Too many errors. (57% scanned). if (end == -1) end = document.cookie.length;