Javascript bible_ Chapter 29

Tham khảo sách 'javascript bible_ chapter 29', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | The Array Object I n array is the sole JavaScript data structure provided for storing and manipulating ordered collections of data. But unlike some other programming languages JavaScript s arrays are very forgiving as to the kind of data you store in each cell or entry of the array. This allows for example an array of arrays providing the equivalent of multidimensional arrays customized to the kind of data your application needs. If you have not done a lot of programming in the past the notion of arrays may seem like an advanced topic. But if you ignore their capabilities you set yourself up for a harder job when implementing many kinds of tasks. Whenever I approach a script one of my first thoughts is about the data being controlled by the application and whether handling it as an array will offer some shortcuts for creating the document and handling interactivity with the user. I hope that by the end of this chapter you will not only be familiar with the properties and methods of JavaScript arrays but you will begin to look for ways to make arrays work for you. Structured Data In programming an array is defined as an ordered collection of data. You can best visualize an array as a table not much different from a spreadsheet. In JavaScript arrays are limited to a table holding one column of data with as many rows as needed to hold your data. As you have seen in many chapters in Part III a JavaScript-enabled browser creates a number of internal arrays for the objects in your HTML documents and browser properties. For example if your document contains five links the browser maintains a table of those links. You access them by number with 0 being the first link in the array syntax the array name followed by the index number in square brackets as in 0 which represents the first link in the document. For many JavaScript applications you will want to use an array as an organized warehouse for data that users of your page access depending on their .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.