JAVASCRIPT ERROR AND DEBUGGING (prefinal)

call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/29

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:03 AM on 4/3/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Add student to class section state
Add studentsNo students in these sections. Invite them to track progress!

30 Terms

1
New cards

Errors

______ in the operation of programs happen due to misconceptions when solving a problem, improper use and typos of the programming language, or the inability to predict user behavior.

2
New cards

Programming language

It communicates just like natural language in that it has its grammar and vocabulary.

3
New cards

grammar and vocabulary.

Programming language communicates just like natural language in that it has its _________ and _________

4
New cards

grammar

The “_________” in the programming language is the syntax, a set of rules that defines the structure of the instructions.

5
New cards

vocabulary

the “_________” are the keywords or list of words that can be used to build instructions.

6
New cards

Syntax Error

Correct Message:

After leaving the mall, turn right into the second path, and drive 600 m. Wait on the spot.

Same Message with Errors: missing period

After leaving the mall, turn right into the second path, and drive 600 m. Wait on the spot

This error violates the language syntax rule, as a declarative sentence should end with a period.

Type of error: __________

7
New cards

Semantic Error

Correct Message:

After leaving the mall, turn right into the second path, and drive 600 m. Wait on the spot.

Same Message with Errors: pth

After leaving the mall, turn right into the second pth, and drive 600 m. Wait on the spot.

This new word is not recognizable in the vocabulary of the natural language, thus creating an error. It can also be a word that is out of context, such as using “male” instead of “mall”.

Type of error: __________

8
New cards

Logical Error

Correct Message:

After leaving the mall, turn right into the second path, and drive 600 m. Wait on the spot.

Same Message with Errors: logical error

After leaving the mall, turn left into the second path, and drive 600 m. Wait on the spot.

It is an error as it is not what was originally the intended direction compared to the original message. This error is not easily detectable by the compiler.

Type of error: __________

9
New cards

SyntaxError

iff (true) {

console.log("true");

}

It appears when a code is ill-formed, just like the sample above, when typos occur, or when unmatching parenthesis or brackets. The code cannot even be executed as JavaScript cannot understand it.

10
New cards

logical error

This error is not easily detectable by the compiler.

11
New cards

ReferenceError

let positive = true;

if (negative == true) {

console.log("true");

}

The semantic error above is called a___________ in JavaScript, as the compiler does not know its meaning. This error occurs when the programmer tries to access a function or a variable that does not exist.

12
New cards

TypeError

const someConstValue = 4;

someConstValue = 3;

console.log(someConstValue);

This error occurs when a specific value is not of the expected type, such as changing the constant value or checking the length of a variable that is not a string.

13
New cards

RangeError

let testArray1 = Array(10);

console.log(testArray1.length);

let testArray2 = Array(-1);

console.log(testArray2.length);

This error is generated when a value is passed to a function outside its acceptable range.

14
New cards

Exceptions

_________

When JavaScript detects syntactic or semantic errors, it generates and throws specific objects with information about the encountered error. In syntax errors, the JavaScript engine does not allow the program to run and uses the console to show the error message.

15
New cards

throws

When JavaScript detects syntactic or semantic errors, it generates and ______ specific objects with information about the encountered error. In syntax errors, the JavaScript engine does not allow the program to run and uses the console to show the error message.

16
New cards

run-time errors, or exceptions

Other errors, however, are called ____________, or ________, which appear while the program is running. By default, thrown exceptions interrupt the program execution and show the appropriate information to appear on the console.

17
New cards

Exception handling, or error handling,

______________, or ____________, is done to prevent the program from stopping in such a situation.

18
New cards

try…catch

try {

console.log('123');

console.log('123');

} catch (error) {

console.log(error.message);

}

To handle exceptions in JavaScript, the _________ statement is used. If an exception is thrown in the code block after the try keyword, the program will not interrupt completely but instead jumps to the part of the code after the catch keyword and continues from there.

19
New cards

finally Statement

_____________ Just like the catch block, this is also an optional block of the try statement, although at least one of them is required or a SyntaxError is thrown.

20
New cards

finally Statement

It can be used with or without the catch block and is always executed after the try and catch blocks, no matter what errors are thrown.

21
New cards

10

10


let a = 5;
try {
a = 10;
} finally {
console.log(a); 
}
console.log(a); 

What will be the output of the code above?

22
New cards

Debugging

__________ is part of troubleshooting in programming.

23
New cards

debugger statement

The ______________ causes the program to stop or halt its execution on the line where it is placed and waits for a decision.

24
New cards

Before debugger

console.log("Before debugger");

debugger; console.log("After debugger");

If debugging is present in a browser, the console in the developer tool will only show the ___________ log and display whether the code execution stopped, paused in the debugger, or is currently in debug mode.

25
New cards

breakpoint

the debugger statement also works as a _________ in the code execution, pausing the debugger execution.

26
New cards

Step-by-Step Program Execution

It is a debugger feature to execute codes on a step-by-step basis. It means that program execution can be stopped at any place using the debugger statement and then continue the execution one instruction at a time.

27
New cards

Resume

resumes the execution of the script typically. The debugger runs the program and “breaks” on user-defined breakpoints.

28
New cards

Step Into

treats the function as a set of instructions intended to be executed separately. It is used when the code needs to be analyzed in detail. The debugger will jump inside the code of the next instruction if it is a function call.

29
New cards

Step Over

is used when the next instruction is a call to a function where the impact is unclear or uninterested. It treats the function call as something indivisible

30
New cards

Step Out

allows to immediately jump out of a function where the code is paused. This action proceeds until the function returns if the debugger is within the code block.

Explore top notes

note
IB Chemistry 3.1 Periodic Table
Updated 1266d ago
0.0(0)
note
Aula APS Redes Territorializacao
Updated 501d ago
0.0(0)
note
EMSF110 - Trauma Exam
Updated 997d ago
0.0(0)
note
US History Chap. 11
Updated 926d ago
0.0(0)
note
AFPF casus 5
Updated 443d ago
0.0(0)
note
World History 2 Midterm
Updated 217d ago
0.0(0)
note
IB Chemistry 3.1 Periodic Table
Updated 1266d ago
0.0(0)
note
Aula APS Redes Territorializacao
Updated 501d ago
0.0(0)
note
EMSF110 - Trauma Exam
Updated 997d ago
0.0(0)
note
US History Chap. 11
Updated 926d ago
0.0(0)
note
AFPF casus 5
Updated 443d ago
0.0(0)
note
World History 2 Midterm
Updated 217d ago
0.0(0)

Explore top flashcards

flashcards
History Unit 5 Test
70
Updated 1127d ago
0.0(0)
flashcards
Los 99 nombres de Allah
100
Updated 215d ago
0.0(0)
flashcards
Antidiabetic Drugs
52
Updated 1219d ago
0.0(0)
flashcards
ИМА
553
Updated 442d ago
0.0(0)
flashcards
NL woordenschat blok 1 en 2
49
Updated 1231d ago
0.0(0)
flashcards
Hinduism
20
Updated 1103d ago
0.0(0)
flashcards
History Unit 5 Test
70
Updated 1127d ago
0.0(0)
flashcards
Los 99 nombres de Allah
100
Updated 215d ago
0.0(0)
flashcards
Antidiabetic Drugs
52
Updated 1219d ago
0.0(0)
flashcards
ИМА
553
Updated 442d ago
0.0(0)
flashcards
NL woordenschat blok 1 en 2
49
Updated 1231d ago
0.0(0)
flashcards
Hinduism
20
Updated 1103d ago
0.0(0)