tailieunhanh - JavaScript Bible, Gold Edition part 112
JavaScript Bible, Gold Edition part 112. This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include programming fundamentals, JavaScript language elements and how to use them effectively, and how to easily and efficiently add powerful new functionality to HTML documents and Java applets. | 958 Part IV JavaScript Core Language Reference The way you use the Math object in statements is the same way you use any JavaScript object You create a reference beginning with the Math object s name a period and the name of the property or method you need method parameter . . . parameter Property references return the built-in values things such as pi . Method references require one or more values to be sent as parameters of the method. Every method returns a result. Properties JavaScript Math object properties represent a number of valuable constant values in math. Table 35-1 shows you those methods and their values as displayed to 16 decimal places. Table 35-1 JavaScript Math Properties Property Value Description Euler s constant Natural log of 2 Natural log of 10 Log base-2 of E Log base-10 of E n Square root of Square root of 2 Because these property expressions return their constant values you use them in your regular arithmetic expressions. For example to obtain the circumference of a circle whose diameter is in variable d employ this statement circumference d Perhaps the most common mistakes scripters make with these properties are failing to capitalize the Math object name and observing the case-sensitivity of property names. Methods Methods make up the balance of JavaScript Math object powers. With the exception of the method all Math object methods take one or more values as parameters. Typical trigonometric methods operate on the single values passed as parameters others determine which of the numbers passed along are the highest or lowest of the group. The method takes no parameters but returns a randomized floating-point value between 0 and 1 note that .
đang nạp các trang xem trước