课程: JavaScript: Five Advanced Challenges and Concepts
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Managing users and capabilities - JavaScript教程
课程: JavaScript: Five Advanced Challenges and Concepts
Managing users and capabilities
- Using classes in JavaScript, you can create and extend advanced data types, and the result is code that is easier to understand and maintain. A good example of when this type of data structure is useful is a management system where a bunch of similar items with unique properties are cataloged and different users have different levels of access and capabilities. You know, like a library, in a very simple library carrying only books, the books are cataloged based on their title, author, publishing year and some other information. At a higher level, they may also be organized by book type, for example, fiction and non-fiction. And for each of these types, there may be unique categorizations, genre for fiction, subject for non-fiction. In such a data structure, it makes sense to make a primary book class, holding the title, author, and publication year info, and then extend it with specialized classes for fiction and…