diff --git a/docs/javascript/data-types/non-primitive-types/object/creating-objects.md b/docs/javascript/data-types/non-primitive-types/object/creating-objects.md index 7745759e7..a956384f4 100644 --- a/docs/javascript/data-types/non-primitive-types/object/creating-objects.md +++ b/docs/javascript/data-types/non-primitive-types/object/creating-objects.md @@ -25,7 +25,6 @@ let objectName = { key2: value2, // ... }; - ``` ### Example: @@ -36,7 +35,7 @@ let person = { firstName: "John", lastName: "Doe", age: 30, - isEmployed: true + isEmployed: true, }; console.log(person); @@ -223,13 +222,13 @@ let objectName = Object.create(prototypeObject, { value: value1, writable: true, enumerable: true, - configurable: true + configurable: true, }, key2: { value: value2, writable: true, enumerable: true, - configurable: true + configurable: true, }, // ... }); @@ -240,16 +239,16 @@ let objectName = Object.create(prototypeObject, { ```javascript title="app.js" // Create a prototype object let personPrototype = { - greet: function() { + greet: function () { return `Hello, my name is ${this.firstName} ${this.lastName}.`; - } + }, }; // Create a new object using the prototype let person = Object.create(personPrototype, { firstName: { value: "John" }, lastName: { value: "Doe" }, - age: { value: 30 } + age: { value: 30 }, }); console.log(person.greet()); @@ -277,4 +276,4 @@ In the example above, the `personPrototype` object defines a `greet` method that ## Conclusion -In this tutorial, you learned how to create objects in JavaScript using object literals, constructors, classes, and the `Object.create()` method. Each method has its advantages and use cases, depending on the complexity and structure of the objects you need to create. Understanding these different methods will help you work with objects effectively in JavaScript. \ No newline at end of file +In this tutorial, you learned how to create objects in JavaScript using object literals, constructors, classes, and the `Object.create()` method. Each method has its advantages and use cases, depending on the complexity and structure of the objects you need to create. Understanding these different methods will help you work with objects effectively in JavaScript. diff --git a/docs/javascript/data-types/non-primitive-types/object/intro.md b/docs/javascript/data-types/non-primitive-types/object/intro.md index 63e7ae5e9..655eb943c 100644 --- a/docs/javascript/data-types/non-primitive-types/object/intro.md +++ b/docs/javascript/data-types/non-primitive-types/object/intro.md @@ -31,13 +31,14 @@ let person = { firstName: "John", lastName: "Doe", age: 30, - isEmployed: true + isEmployed: true, }; console.log(person); ``` -In this example, `person` is an object with four properties: +In this example, `person` is an object with four properties: + - `firstName` is a property with the value `"John"`. - `lastName` is a property with the value `"Doe"`. - `age` is a property with the value `30`. @@ -72,7 +73,7 @@ Consider an online shopping cart. You might represent a shopping cart as an obje let shoppingCart = { apple: 2, banana: 3, - orange: 1 + orange: 1, }; console.log(shoppingCart); @@ -84,4 +85,4 @@ Objects are versatile and can be used to model a wide range of real-world entiti ## Conclusion -In this tutorial, you learned about objects in JavaScript, how to create objects, and the importance of objects in JavaScript programming. Objects are a fundamental part of JavaScript and are used to represent complex data structures in a flexible and dynamic way. \ No newline at end of file +In this tutorial, you learned about objects in JavaScript, how to create objects, and the importance of objects in JavaScript programming. Objects are a fundamental part of JavaScript and are used to represent complex data structures in a flexible and dynamic way. diff --git a/docs/javascript/data-types/primitive-types/bigint.md b/docs/javascript/data-types/primitive-types/bigint.md index cb1b624f3..a34a463f7 100644 --- a/docs/javascript/data-types/primitive-types/bigint.md +++ b/docs/javascript/data-types/primitive-types/bigint.md @@ -126,4 +126,4 @@ The `BigInt` data type was introduced in ECMAScript 2020 (ES11) to provide a way ## Conclusion -The `BigInt` data type in JavaScript provides a way to work with integers of arbitrary length, overcoming the limitations of the `Number` data type for very large numbers. By using `BigInt` values, you can perform precise integer arithmetic and handle calculations that exceed the maximum safe integer value in JavaScript. \ No newline at end of file +The `BigInt` data type in JavaScript provides a way to work with integers of arbitrary length, overcoming the limitations of the `Number` data type for very large numbers. By using `BigInt` values, you can perform precise integer arithmetic and handle calculations that exceed the maximum safe integer value in JavaScript. diff --git a/docs/javascript/data-types/primitive-types/boolean.md b/docs/javascript/data-types/primitive-types/boolean.md index 72599ef7a..7560d0419 100644 --- a/docs/javascript/data-types/primitive-types/boolean.md +++ b/docs/javascript/data-types/primitive-types/boolean.md @@ -102,7 +102,7 @@ console.log(a <= b); // Output: false You can use the conditional (ternary) operator to assign values based on a condition. The syntax of the conditional operator is as follows: ```javascript -condition ? valueIfTrue : valueIfFalse +condition ? valueIfTrue : valueIfFalse; ``` Here's an example of using the conditional operator with `Boolean` values: @@ -143,7 +143,7 @@ console.log(Boolean(null)); // Output: false console.log(Boolean(undefined)); // Output: false console.log(Boolean({})); // Output: true console.log(Boolean([])); // Output: true -console.log(Boolean(function() {})); // Output: true +console.log(Boolean(function () {})); // Output: true console.log(Boolean(true)); // Output: true console.log(Boolean(false)); // Output: false ``` @@ -156,4 +156,4 @@ The `Boolean()` function is useful when you need to convert values to `Boolean` ## Conclusion -In this tutorial, you learned about the `Boolean` data type in JavaScript, how to create `Boolean` values using `true` and `false` literals, and common operations with `Boolean` values. You also learned how to convert values to `Boolean` using the `Boolean()` function. \ No newline at end of file +In this tutorial, you learned about the `Boolean` data type in JavaScript, how to create `Boolean` values using `true` and `false` literals, and common operations with `Boolean` values. You also learned how to convert values to `Boolean` using the `Boolean()` function. diff --git a/docs/javascript/data-types/primitive-types/null.md b/docs/javascript/data-types/primitive-types/null.md index 8d9802a5f..95a9c4803 100644 --- a/docs/javascript/data-types/primitive-types/null.md +++ b/docs/javascript/data-types/primitive-types/null.md @@ -127,7 +127,7 @@ In the example above, the strict equality comparison (`===`) checks if `nullValu You can use the conditional (ternary) operator to assign values based on a condition. The syntax of the conditional operator is as follows: ```javascript -condition ? valueIfTrue : valueIfFalse +condition ? valueIfTrue : valueIfFalse; ``` Here's an example of using the conditional operator with `null` values: @@ -147,4 +147,4 @@ The conditional operator evaluates the condition (`nullValue` in this case) and ## Conclusion -In this tutorial, you learned about the `null` data type in JavaScript, how to create `null` values, and common operations with `null` values. You can use the `null` value to represent the intentional absence of any object value in your JavaScript programs. \ No newline at end of file +In this tutorial, you learned about the `null` data type in JavaScript, how to create `null` values, and common operations with `null` values. You can use the `null` value to represent the intentional absence of any object value in your JavaScript programs. diff --git a/docs/javascript/data-types/primitive-types/symbol.md b/docs/javascript/data-types/primitive-types/symbol.md index 2b4e9447a..1ba969f19 100644 --- a/docs/javascript/data-types/primitive-types/symbol.md +++ b/docs/javascript/data-types/primitive-types/symbol.md @@ -61,7 +61,7 @@ let firstName = Symbol("firstName"); let person = { [firstName]: "John", lastName: "Doe", - age: 30 + age: 30, }; console.log(person[firstName]); // Output: John @@ -79,9 +79,9 @@ let logSymbol = Symbol("log"); // Create an object with a symbol property let logger = { - [logSymbol]: function(message) { + [logSymbol]: function (message) { console.log(message); - } + }, }; logger[logSymbol]("Logging a message"); // Output: Logging a message @@ -131,4 +131,4 @@ Symbols are a powerful feature in JavaScript that allow you to create unique ide ## Conclusion -In JavaScript, the `Symbol` data type is used to create unique and immutable values that can be used as property keys in objects. Symbols are guaranteed to be different from other values and are often used to create private properties, avoid property name collisions, and define special behaviors in objects. By using symbols, you can create unique identifiers that are not accessible using regular property access methods, making them a powerful tool for defining object properties and behaviors. \ No newline at end of file +In JavaScript, the `Symbol` data type is used to create unique and immutable values that can be used as property keys in objects. Symbols are guaranteed to be different from other values and are often used to create private properties, avoid property name collisions, and define special behaviors in objects. By using symbols, you can create unique identifiers that are not accessible using regular property access methods, making them a powerful tool for defining object properties and behaviors.