Related to JavaScript if and else statements

What is meant by following lines if(typeof(Storage)!=="undefined") else {"your browser does not support local storage"}

3/29/2020 9:16:37 AM

Muhammad Awwab Khan

1 Answer

New Answer


For a javascript engine, this code means "syntax error"... But for an human it would be translated to this kind of correct code: if (typeof(Storage)!=="undefined") {} else { alert("your browser does not support local storage") } wich translated in human words means: "if object Storage exists do nothing, else display message to user", wich could be done less verbosely by: if (!Storage) { alert("your browser..." }