This is very basic scripting knowledge and thus the answer and many details can easly be found in the
Official Scripting Documentation if you browse the different functions and objects a little. (click the link or simply choose Help in the Script Editor).
It is not that we don't wanna help you, but as I said, this is such a basic question that you'll find your answer quickly if you read the documentation.