简体   繁体   中英

';' expected.ts(1005) in Javascript

I was creating a redirect function named redirect() and when I open the curly brackets it shows an error saying

';' expected.ts(1005)

Any reason? I'm not sure what ts(1005) means so I don't know what to do. 错误

The error fixes when I put a semicolon but then in the browser, it shows an error saying

Uncaught TypeError: redirect is not a function at HTMLInputElement.onclick

Although it could be a different error. (Solve if you can please) Thanks

If you want to define a function, place the keyword function before redirect() .
A ; is expected because without function the browser thinks it is a function .
(Is 1005 the line number?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM