Blog

python tutorials and learn python

Created with Sketch.

JavaScript Getters and Setters

JavaScript Getters and Setters Summary: in this tutorial, you will learn about JavaScript getters and setters and how to use them effectively. Introduction to the JavaScript getters and setters The following example defines a class called Person: class Person { constructor(name) { this.name = name; } } let person = new Person(“John”); console.log(person.name); // John…
Read more

JavaScript Class

JavaScript Class Summary: in this tutorial, you’ll learn about the JavaScript class and how to use it effectively. A JavaScript class is a blueprint for creating objects. A class encapsulates data and functions that manipulate data. Unlike other programming languages such as Java and C#, JavaScript classes are syntactic sugar over the prototypal inheritance. In…
Read more

Object Literal Syntax Extensions in ES6

Object Literal Syntax Extensions in ES6 Summary: in this tutorial, you will learn about the syntax extensions of the object literal in ES6 that make your code cleaner and more flexible. The object literal is one of the most popular patterns for creating objects in JavaScript because of its simplicity. ES6 makes the object literal more…
Read more

JavaScript Optional Chaining Operator

JavaScript Optional Chaining Operator Summary: in this tutorial, you’ll learn about the optional chaining operator (?.) that simplifies the way to access values through connected objects. Introduction to the JavaScript optional chaining operator The optional chaining operator (?.) allows you to access the value of a property located deep within a chain of objects without…
Read more

JavaScript Object Destructuring

JavaScript Object Destructuring Summary: in this tutorial, you’ll learn about JavaScript object destructuring which assigns properties of an object to individual variables. If you want to learn how to destructure an array, you can check out the array destructuring tutorial. Introduction to the JavaScript object destructuring assignment Suppose you have a person object with two…
Read more

JavaScript Factory Functions

JavaScript Factory Functions Summary: in this tutorial, you will learn about the JavaScript factory functions which are functions that return objects. Introduction to the factory functions in JavaScript A factory function is a function that returns a new object. The following creates a person object named person1: let person1 = { firstName: ‘John’, lastName: ‘Doe’,…
Read more

JavaScript Object.is()

JavaScript Object.is() Summary: in this tutorial, you will learn about the JavaScript Object.is() to check if two values are the same. The Object.is() behaves like the === operator with two differences: -0 and +0 NaN Negative zero The === operator treats -0 and +0 are the same value: let amount = +0, volume = -0;…
Read more

JavaScript Object.assign()

JavaScript Object.assign() Summary: in this tutorial, you will learn how to use the JavaScript Object.assign() method in ES6. The following shows the syntax of the Object.assign() method: Object.assign(target, …sources) Code language: CSS (css) The Object.assign() copies all enumerable and own properties from the source objects to the target object. It returns the target object. The…
Read more

JavaScript Object.entries()

JavaScript Object.entries() Summary: in this tutorial, you will learn how to use the JavaScript Object.entries() method. Introduction to JavaScript Object.entries() method ES2017 introduces the Object.entries() method that accepts an object and returns its own enumerable string-keyed property [key, value] pairs of the object. Here is the syntax of the Object.entries() method: Object.entries() Code language: JavaScript…
Read more

JavaScript Object.values()

JavaScript Object.values() Summary: in this tutorial, you will learn how to use the JavaScript Object.values() method to access the own enumerable properties of an object. Prior to ES2017, you use a for…in loop and Object.hasOwnProperty()  method to access values of own enumerable properties of an object. For example: const person = { firstName: ‘John’, lastName:…
Read more