Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Web Developer's Reference Guide

You're reading from   Web Developer's Reference Guide A one-stop guide to the essentials of web development including popular frameworks such as jQuery, Bootstrap, AngularJS, and Node.js

Arrow left icon
Product type Paperback
Published in Mar 2016
Publisher
ISBN-13 9781783552139
Length 838 pages
Edition 1st Edition
Arrow right icon
Authors (3):
Arrow left icon
 Johanan Johanan
Author Profile Icon Johanan
Johanan
 Khan Khan
Author Profile Icon Khan
Khan
 Zea Zea
Author Profile Icon Zea
Zea
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. HTML Elements FREE CHAPTER 2. HTML Attributes 3. CSS Concepts and Applications 4. CSS Properties – Part 1 5. CSS Properties – Part 2 6. CSS Properties – Part 3 7. CSS Functions 8. JavaScript Implementations, Syntax Basics, and Variable Types 9. JavaScript Expressions, Operators, Statements, and Arrays 10. JavaScript Object-Oriented Programming 11. Extending JavaScript and ECMAScript 6 12. Server-side JavaScript – NodeJS 13. Bootstrap – The Stylish CSS Frontend Framework 14. jQuery – The Popular JavaScript Library 15. AngularJS – Google's In-Demand Framework Index

Classes and modules


In JavaScript, we do not have any native approach to creating classes, but we can create a class using prototype inheritance and a constructor function.

Classes are containers for objects. We use classes to encapsulate a namespace and logic.

To instantiate a class, we can use the new keyword. Classes are similar to constructor functions. Here is an example:

function student(nameI) {
  This.name=name;
  this.age='18';
}
student.prototype.std=function() {
  //define some code
};
module.export=student;

Note

Modules are used to include and extend classes and properties easily. Modules attach properties to global objects to export module values.

Classes and their modules are extremely important and vital aspects of JavaScript. We will be covering the following topics in the subsequent sections:

  • Classes and prototypes

  • Constructors

  • Java-style classes in JavaScript

  • Augmented JavaScript

  • Types of classes

  • Subclasses

  • Classes in ECMA5 script

  • Modules

Classes and prototypes

In JavaScript, a class is...

lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Web Developer's Reference Guide
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon