What is the difference between syntax errors and run-time errors?

What will be an ideal response?


Run-time errors differ from syntax errors in that they do not necessarily represent JavaScript language errors. Instead, run-time errors occur when the interpreter encounters code that it cannot execute. For example, consider the statementcreateRecommendation();, which calls a custom JavaScript function. This statement does not generate a syntax error, because it is legal (and usually necessary) to create and then call custom functions in a JavaScript program. However, if your program includes the call statement but does not include code that creates the function in the first place, your program generates a run-time error. The error occurs when the interpreter attempts to call the function and is unable to find it.

Computer Science & Information Technology

You might also like to view...

Which of the following is a special disk used to make decisions if host computers lose communication with each other?

A. passthrough B. CSV C. target D. witness

Computer Science & Information Technology

File compression programs reduce the disk space used by files

Indicate whether the statement is true or false

Computer Science & Information Technology

If you want to store state information that will be available when a client revisits your Web site in the future, you must use ____.

A. sessions B. cookies C. autoglobals D. hidden form fields

Computer Science & Information Technology

An audio file's sample is measured by the number of cycles in the sound's sine wave or waveform.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology