TAILIEUCHUNG - Học JavaScript qua ví dụ part 29

Các đối tượng String Chúng tôi đã sử dụng dây trong suốt cuốn sách này. Họ đã được gửi như các đối số để ghi () và writeln () phương pháp, họ đã được giao cho các biến, chúng đã được nối, và như vậy. Như bạn có thể nhớ lại, một chuỗi là một chuỗi các ký tự kèm theo một trong hai đôi hoặc đơn | The Math Object 247 Figure Producing random numbers Example . provide properties and methods that can be defined for the object. For example the String object has a number of methods that let you change the font color size and style of a string and the Number object has methods that allow you to format a number to a specified number of significant digits. Whether you use the object or literal notation to create a string number or Boolean JavaScript handles the internal conversion between the types. The real advantage to the wrapper object is its ability to apply and extend properties and methods to the object which in turn will affect the primitive. The String Object We have used strings throughout this book. They were sent as arguments to the write and writeln methods they have been assigned to variables they have been concatenated and so on. As you might recall a string is a sequence of characters enclosed in either double or single quotes. The String object starting with JavaScript is a core JavaScript object that allows you to treat strings as objects. The String object is also called a wrapper object because it wraps itself around a string primitive allowing you to apply a number of properties and methods to it. You can create a String object implicitly by assigning a quoted string of text to a variable called a string primitive see Primitive Data Types on page 53 of Chapter 3 The Building Blocks Data Types Literals and Variables or by explicitly creating a String object with the new keyword and the String object constructor method. Either way the properties and methods of the String object can be applied to the new string variable. From the Library of 248 Chapter 9 JavaScript Core Objects FORMAT var string_name string of text var string_name new String string of text EXAMPLE var title JavaScript by Example var title new String JavaScript by Example EXAMPLE html head title The String Object title head body bgcolor pink

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.