Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 1. Core Concepts > Constructor Parameters and Arguments

1.13. Constructor Parameters and Arguments

A constructor parameter is special type of local variable that is created as part of a constructor-method definition. Unlike regular local variables, a constructor parameter's initial value can be (or in some cases, must be) supplied externally when a new object is instantiated.

Constructor parameters are not created with the keyword var. Instead, to create a constructor parameter, we simply provide the desired name and variable initializer within the parentheses of a constructor function definition, as shown in the following generalized code:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial