Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why they use reserved keyword 'continue' to name a function in IndexedDB's Cursor object?

According to http://www.w3.org/TR/IndexedDB/#widl-IDBCursor-continue, the IDBCursor object has methods named "continue" and "delete". Aren't those reserved keywords? Why would they use these names in the specs?

My javascript compiler keeps warning me about the reserved keyword and its really annoying.

like image 247
Chan Le Avatar asked Aug 29 '11 20:08

Chan Le


2 Answers

If you just want to "shut the compiler up" you can use string based property access instead:

obj['continue']

is the same as

obj.continue
like image 171
hugomg Avatar answered Oct 06 '22 00:10

hugomg


The presence of .continue() will make IE8 bark with "SCRIPT1010: Expected identifier" even if that part of the code is never run. So it is probably a good thing that your compiler warns you.

missingnos solution solved this problem.

like image 22
sorenbs Avatar answered Oct 06 '22 01:10

sorenbs