TGViewer
Channel Public Channel
Diyorbek.dev | πŸ‘¨πŸ»β€πŸ’»

Diyorbek.dev | πŸ‘¨πŸ»β€πŸ’»

@diyorbekk_dev

Allohga taqvo qiling. Va Alloh sizga ilm beradi. [2:282]


Software engineer @ OctaneJS Core Team

Dasturchi, jiddiy, kamgap, oddiy inson


Γ’zim haqimda kΓ²proq ma'lumot uchun: @Diyorbek_juraev_blog

Web sahifam: https://mrdiyorbek.uz/
Subscribers
380
Photos
299
Videos
35
Links
119

Showing posts older than #683 Β· Back to latest

Older Posts 11 shown
Post #681 144
How do you compare Object and Map?

1) Keys:
Objects: Keys are limited to Strings and Symbols.
Maps: Keys can be any value, including functions, objects, and primitives.

2) Order:

Objects: Keys have no guaranteed order.
Maps: Keys are ordered based on insertion sequence.

3) Size:
Objects: Size must be determined manually.
Maps: Size can be easily obtained using the size property.

4) Iteration:
Objects: Require manual key extraction for iteration.
Maps: Are directly iterable.

5) Prototype:
Objects: Have a prototype, which may lead to unintended key collisions.
Maps: Provide a clean alternative without a prototype.


Performance:

6) Maps: May perform better in scenarios involving frequent addition and removal of key-value pairs.

In conclusion, Maps offer more flexibility, ordering, and ease of use, especially for scenarios involving iteration and frequent modifications.

One Step ahead of the best✊

@Diyorbekk_dev
  • ⚑ 1
  • β˜ƒ 1
Post #679 109
What is the difference between slice and splice?

One Step ahead of the best✊

@Diyorbekk_dev
  • πŸ‘ 1
Post #677 118
What is the purpose of the array slice method?

The slice() method in JavaScript is a powerful tool when working with arrays. Its main purpose is to extract a portion of an array and return it as a new array, without modifying the original array.

Selection of Elements:
The method takes one or two arguments. The first argument is the starting index from which elements will be selected.
The second argument (optional) is the ending index (exclusive) up to which elements will be selected. If this argument is not provided, the selection continues until the end of the array.


Creating a New Array:
The selected elements are then returned as a new array. This means that the original array remains unchanged.

Non-Destructive Operation:
Importantly, the slice() method does not modify the original array. This is crucial when you want to work with subsets of an array without altering the source data.

One Step ahead of the best✊

@Diyorbekk_dev
  • ⚑ 1
  • πŸ‘ 1
Post #676 123
Shu joylayrni soΔ£indim!

Ajoyib damlar bo'lgandi! 😊

@Diyorbekk_dev
  • πŸ‘ 5
  • ❀ 3
Post #675 112
What is JSON and its common operations?

JSON (JavaScript Object Notation)


JSON
is a text-based data format following JavaScript object syntax, which was popularized by Douglas Crockford. It is useful when you want to transmit data across a network and it is basically just a text file with an extension of .json, and a MIME type of application/json

Parsing: Converting a string to a native object
JSON.parse(text);


Stringification: converting a native object to a string so it can be transmitted across the network
JSON.stringify(object);


β–ͺ️ JSON is a lightweight data interchange format that is easy for humans to read and write and easy for machines to parse and generate.
β–ͺ️ It is often used to transmit data between a server and web application, as well as to store configuration data.
β–ͺ️ The data in JSON is represented as key-value pairs, similar to objects in JavaScript


@Diyorbekk_dev
  • πŸ‘ 2
Post #671 132
What is the difference between Call, Apply and Bind?

The difference between Call, Apply and Bind can be explained with examples,

Call: The call() method invokes a function with a given this value and arguments provided one by one!

Apply: Invokes the function with a given this value and allows you to pass in arguments as an array!

Bind: returns a new function, allowing you to pass any number of arguments!

Call and Apply are pretty interchangeable. Both execute the current function immediately. You need to decide whether it’s easier to send in an array or a comma separated list of arguments. You can remember by treating Call is for comma (separated list) and Apply is for Array.

Whereas Bind creates a new function that will have this set to the first parameter passed to bind()

Dictionary
interchangeable - things that are interchangeable can be used instead of each other


@Diyorbekk_dev
  • ⚑ 2
  • πŸ‘ 2
Post #669 105
What is a prototype chain?

Prototype chaining is used to build new types of objects based on existing ones. It is similar to inheritance in a class based language.

The prototype on object instance is available through Object.getPrototypeOf(object) or (_proto_) property whereas prototype on constructors function is available through Object.prototype.

@Diyorbekk_dev
Post #667 111
Diyorbek.dev | πŸ‘¨πŸ»β€πŸ’» What are the possible ways to create objects in JavaScript? Sizlar bilan qanday qilib JavaScript-da object yaratish yo'llarini ko'rib chiqamiz! @Diyorbekk_dev
What are the possible ways to create objects in JavaScript?

1) Object literal syntax:

The object literal syntax (or object initializer), is a comma-separated set of name-value pairs wrapped in curly braces.
Note: This is an easiest way to create an object.

2) Object constructor:

The simplest way to create an empty object is using the Object constructor. Currently this approach is not recommended.πŸ™…β€β™‚οΈ
The Object() is a built-in constructor function so "new" keyword is not required. The above code snippet can be re-written as:
var object = Object();


3) Object's create method:
The create method of Object is used to create a new object by passing the specificied prototype object and properties as arguments. i.e., This pattern is helpful to create new objects based on existing objects. The second argument is optional and it is used to create properties on a newly created object.

The following code creates a new empty object whose prototype is null.
var object = Object.create(null);


4) Function constructor:
In this approach, create any function and apply the new operator to create object instances.

5) Function constructor with prototype:
This is similar to function constructor but it uses prototype for their properties and methods,
This is equivalent to an instance created with an object create method with a function prototype and then call that function with an instance and parameters as arguments.

6) ES6 Class syntax:
ES6 introduces class feature to create the objects

7) Singleton pattern:
A Singleton is an object which can only be instantiated one time. Repeated calls to its constructor return the same instance and this way one can ensure that they don't accidentally create multiple instances.

@Diyorbekk_dev
Post #660 106
What are the possible ways to create objects in JavaScript?

Sizlar bilan qanday qilib JavaScript-da object yaratish yo'llarini ko'rib chiqamiz!

@Diyorbekk_dev
  • πŸ‘ 1
Older posts β†’
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook β†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 β†’