Javascript Notes

mobiprep (6).png

JavaScript

mobiprep (6).png

Data Types

mobiprep (6).png

Variables

mobiprep (6).png

Operators

mobiprep (6).png

Functions

mobiprep (6).png

Conditional Statements and Loops

mobiprep (6).png

Arrays

mobiprep (6).png

Objects

mobiprep (6).png

DOM Elements

mobiprep (6).png

Cookies

mobiprep (6).png

Pop Up Box

mobiprep (6).png

Exception Handling

Heading

Q

1

What is a Pop up box?

LRM_EXPORT_207556595493866_20190724_1939

Ans

For showing a warning or any other important information to website visitors Popup boxes are used.
There are three types of popup box available to use in JavaScript. They are as follows :
alert()
confirm()
prompt()
1-alert() - JavaScript MessageBox To inform or alert the user by displaying some messages in a small dialogue box alert box is used. The alert() method doesn't have an object name in front of it, because the alert() method is part of the window Object .User will have to click "OK" to proceed when an alert box pops up.
2-confirm() - To let the user make a choice confirmation box is used . The user will have to click either "OK" or "Cancel" to proceed the next step when Javascript pops up a confirm box. Depending on what button the user clicks ifferent actions will occur. These course of action can be specified with conditional logic.
3-prompt() - Javascript Prompt Box is used when you want the user to enter an input value before proceeding to the next step. The user should click either "OK" or "Cancel" to proceed after entering an input value when Javascript displays a prompt box. Depending on what exactly the user does with the dialog,the return value of prompt box will be decided.

The user input string will be returned by prompt method if the user types something,then clicks OK or presses Enter. If the user clicks OK or presses Enter without typing anything into the prompt dialog , the method returns the suggested input, as specified in the second argument passed to prompt. If the user dismisses the dialog by clicking Cancel or pressing Esc or any cancelation action , then in most browsers the prompt method returns null.

LRM_EXPORT_207556595493866_20190724_1939

Q

2

What is the difference between confirmation box and alert box?

LRM_EXPORT_207556595493866_20190724_1939

Ans

LRM_EXPORT_207556595493866_20190724_1939