Level 120 Level 122
Level 121

[Quiz] Error Handling

36 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Do we always get an error message where there is an error?
many JavaScript problems have failed silently. There will be no error message. They just won't work, in some situations we can get error messages.
most web browsers won't alert you to any JavaScript issues.
How do most of the web browsers react most of the JS errors?
syntax errors
What kind of mistakes can we make in coding?
What is a syntax error?
it is badly written code.
What is the most common syntax errors with functions?
You're trying to call a function that doesn't exist, whether that is because of this situation just a typo.
When do we get undefined function error message?
when we call a user defined function which has not been defined.
When do we get a "is not a function" error message?
when we try to use a prebuilt function and we misspell the code. instead of getElementById we write getElementByID
Why do we get different message here?
It's giving you a slightly different message here, because this is considered a method of an object rather than a function.
Do all the browsers give the same error message?
depending on what browser you're using, you may even see different messages for that.
We have to make sure that the page is loaded.
What do we have to make sure in JS in the first place?
sometimes it is not enough.
To do it is it enough to put the script tag before the closing body tag?
What are object methods?
first. only objects have methods. so there are not other methods. they are functions belonging to objects.
when part of the page has not loaded yet.
When does it happen that you get an undefined variable error message even though it seems to have been defined?
What happens when it is not loaded?
the elements are not loaded into the DOM which means we can not manipulate the handles of the DOM elements beucase they are available only if the whole page has been loaded.
So that we can manipulate them.
Why do elements have to be loaded into the DOM?
we use window.onload event handler to make sure.
How can we make sure that all elements have been loaded?
How do we write window.onload event handler?
the same way as we write the other handlers.
How is it that?
window.onload = function (){ // code comes here.
no you will not get an error message. only things will not work as you expect it.
Will you get an error message when you want to save a handle into variable but all the elements have not been loaded into the DOM?
when we want to do equality but instead we do assignment accidentally.
Do we get an error message if we use assignment instead of equality?
because functions and variables are the same. the only difference between them is that functions are variables into which action is saved while in variables pure data is saved.
what are c-based languages?
languages which programming styles are based on C language.
we got a message in the console. the message is NaN.
What if a function takes three parameters but we define two parameters when we call it?
What does NaN mean?
it means that the result is Not a Number.
Is NaN an error message?
No it is not. it only states that the result is not a number.
Why do we get NaN?
because we try to add two or three variables but one is not a number e.g. it has not been defined.. and if you want to add a number and a variable that does…
Did we get NaN because we can not pass less parameters?
no we got NaN because the interpreter could not add 500 and 1000 and c (undefined value) together.
no we do not. we are allowed to pass less parameters. it does not cause an error.
Do we get an error message if we call a function passing less parameters than it was defined with?
the last one would be accepted as undefined
What happens if we call a function passing in less parameters than it was defined with?
result is not a number. (NaN)
What happens if you want to add a number and a variable that does not make sense?
unterminated sting literal.
Firebug will render a message that doesn't make much sence..
the uppercase 'D' should be lowercase 'd'
What is the problem with getElementByID? The is error 'is not a function'.
A variable is a container for information that you want to store.
In a conditional statement you need double or triple equals.
if (a - b) {... will result in 'true' }. Why?
what is returned and why
NaN. Adding an undefined variable to a number results in not a number.