From the course: JavaScript on the Go: Objects
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
JavaScript classes - JavaScript Tutorial
From the course: JavaScript on the Go: Objects
JavaScript classes
- [Instructor] So far, we've reviewed how to create objects using object literals and constructor functions. Both have some differences in syntax and behavior. JavaScript also has a class construct that provides an alternative syntax for creating objects. You can use classes to achieve similar functionality to constructor functions and they're useful for object oriented programming. Classes were introduced in JavaScript with the release of ECMAScript 2015 or ES6. Before that, JavaScript had no native class implementation. It used prototype based inheritance where only constructor functions allowed for object-oriented programming, which presented a challenge for developers who were used to using classes and other programming languages. So adding classes made it easier for developers familiar with classes and other languages to write and understand object-oriented code in JavaScript. So if you're looking for a more structured…
Contents
-
-
-
Inheritance in JavaScript3m 26s
-
(Locked)
The object literal3m 9s
-
(Locked)
Define an object using a constructor function4m 42s
-
(Locked)
Create objects using an existing object as the prototype2m 58s
-
(Locked)
Merge two or more JavaScript objects into a new object3m 52s
-
(Locked)
Common ways to iterate over objects3m 25s
-
(Locked)
JavaScript classes4m 17s
-
(Locked)
Class-based vs. prototype-based inheritance2m 52s
-
-