Where allignToTop is a boolean value which is optional. You can set it to true or false.
Parameter: Boolean value that indicated the type of align.
The method doesn't return any value.
Example : This example will illustrate the scrollIntoView() method. In this example we have created a scrollable area in which some text is written, when user click on the button then the text is displayed according to the button clicked. If first button is clicked then the top of the text is displayed because true is default value and if the second button is clicked then the bottom of the text is displayed.
Output : When you click on the first button "Click view" then it will display the text at the top of the scrollable area because true is the default one.
And, when you click on the second button i.e."Click view" than the text in the bottom will displayed.
As you can see the difference between the two output.
Recommend the tutorial