
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Create object literals in JavaScript and define properties like brand, model, and year using literal syntax, then add, read, and delete properties, with multiword keys in quotes and trailing commas.
Explore square brackets usage for JavaScript objects, contrasting dot notation’s identifier rules, with computed properties and runtime key access using expressions and variables.
Explore how JavaScript object properties have no name restrictions, accepting any string or symbol, with numbers converting to strings, and the __proto__ case where primitive values are ignored.
Explore checking property existence in modern JavaScript using the in operator. Understand how undefined and null affect detection and when in reliably identifies existing properties.
Learn to iterate object keys with the for..in loop in modern JavaScript OOP, using key or prop, and note that integer keys sort while non-integers follow creation order.
Explore reference-based comparison in modern JavaScript object-oriented programming, where two objects are equal only if they reference the same object, and independent look-alikes may become unequal due to primitive conversions.
Create a copy by copying properties into a new object, then use Object.assign with a dest and source objects to merge and overwrite properties, and return the result.
Learn how to perform deep cloning of nested structures in JavaScript using structuredClone, handling objects, arrays, and circular references, and when to combine methods for functions or library solutions.
Explore how modern JavaScript represents real world actions as object methods, using function expressions and shorthand syntax, and learn how the this keyword guides method behavior.
Learn how arrow functions in modern JavaScript do not have their own this but borrow it from the outer context, simplifying surrounding scope usage.
Master modern object-oriented programming in JavaScript by using constructor functions and the new operator to create reusable object templates for multiple items.
Explore how constructor functions power modern JavaScript object oriented programming by creating flexible objects with parameters, properties, and methods, including a say hi method example.
Learn how optional chaining safely accesses nested properties in JavaScript objects without errors when values are missing, with examples using document.querySelector and undefined or null.
Explore how short-circuiting works in modern JavaScript object-oriented programming, using the question mark to stop evaluation when the left part is missing and prevent right-side operations.
Master optional chaining in modern JavaScript OOP using the ?.() and ?.[] syntax to safely call a possibly missing admin method and read properties.
Understand the JavaScript symbol type as a primitive, unique key with optional description; symbols remain distinct even with identical descriptions and don’t auto-convert to strings, unless you call toString.
Explore how symbols create hidden properties in JavaScript objects to safely attach unique identifiers, even for third-party code, while avoiding conflicts with string keys.
Explore the global symbol registry and learn how Symbol.for reads or creates a shared symbol across an app, while Symbol.keyFor retrieves its key.
Explore how system symbols in modern JavaScript enhance object behavior, using the symbol table and examples like symbol.toPrimitive for primitive conversion.
Learn how JavaScript converts objects to primitive values during operations, with numeric and string conversions, boolean behavior, and the role of date subtraction and symbol-based methods in custom conversions.
Learn how JavaScript determines object to primitive conversions using hints: string, number, and default, via methods like Symbol.toPrimitive, valueOf, and toString, with examples.
Learn how symbol.toPrimitive defines a conversion method that handles all type hints, enabling a user object to yield a string or a money amount depending on the context.
Discover how toString and valueOf customize primitive conversion in JavaScript objects, with priority rules for string hints and math hints, and practical examples of implementing fallback behavior.
In this comprehensive course on object-oriented programming (OOP) in modern JavaScript, you'll explore fundamental concepts and advanced techniques to enhance your mastery of JavaScript's OOP capabilities.
We begin by examining the basics, including object literals, square bracket usage, and property shorthand, alongside restrictions on property names and object iteration using `for...in` loops.
Advancing further, we delve into complex topics like object references, duplication, and reference-based comparison. You'll learn to modify constant objects, clone objects with nested structures, and grasp methods within objects, with a focus on the `this` keyword's significance.
Next, we introduce constructor functions and the `new` operator, clarifying constructor return values and demonstrating how to utilize optional chaining for error prevention and code optimization.
You'll also develop a profound understanding of symbol types, their global applications, and system symbol utilization. Additionally, we'll address object-to-primitive conversion strategies, including hints, and examine `toString` and `valueOf` methods for effective conversion management.
By course end, you'll possess a comprehensive grasp of modern JavaScript's OOP concepts, enabling you to write concise, efficient code and confidently tackle intricate programming challenges. This knowledge will not only elevate your JavaScript skills but also enhance your ability to design robust and scalable applications, making you a more versatile and valuable developer in today's competitive landscape.