A function that is declared without any named identifier is known as an anonymous function. In general, an anonymous function is inaccessible after its declaration.
*Operators are without the parenthesis.
34. What is the role of break and continue statements?
Break statement is used to come out of the current loop while the continue statement continues the current loop with a new recurrence.
DOM stands for Document Object Model and is responsible for how various objects in a document interact with each other. DOM is required for developing web pages, which includes objects like paragraph, links, etc. These objects can be operated to include actions like add or delete. DOM is also required to add extra capabilities to a web page. On top of that, the use of API gives an advantage over other existing models.
36. Explain the unshift() method ?
This method is functional at the starting of the array, unlike the push(). It adds the desired number of elements to the top of an array.
I am assuming that js file name is message.js, place the following script tag inside the head tag.
38. What is DOM? What is the use of document object?
DOM stands for Document Object Model. A document object represent the html document. It can be used to access and change the content of html.
39. What is the use of window object?
The window object is automatically created by the browser that represents a window of a browser.
It is used to display the popup dialog box such as alert dialog box, confirm dialog box, input dialog box etc.
40. What is the use of history object?
The history object of browser can be used to switch to history pages such as back and forward from current page or another page. There are three methods of history object.
- go(number): number may be positive for forward, negative for backward.