Ishrat Profile picture
Aug 28 13 tweets 3 min read Twitter logo Read on Twitter
Objects in JavaScript 🚀

A Thread ↓ Image
Objects are collections of `key: value` pairs. These `key: value` pairs are also called properties.

JavaScript objects enable you to store, manipulate, and send data across a network.

In objects, you can store in-depth, composite/complex data.
⚡ Create objects

In JavaScript, creating an object is quite easy. To create an object, all you need is a set of curly braces `{ }` and within that, you have to write `key: value` pairs separated with a comma `,`.

Here's an example to understand it better: Image
If you need to access any of the object's properties. The value of a property can be accessed by using its `key`. There are two methods to access the object's properties:
🔸 The dot notation
This is the most commonly used method.

Example:
console.log(blogPost.title); // Output: Objects in JavaScript
🔸 The bracket notation

You can use bracket notation to replace the dot(`.`) with square brackets `[ ]` and then convert the `key` name to a `string`.

Example:

console.log(blogPost["title"]); // Output: Objects in JavaScript
⚡ Nested objects

The object within an object is called a nested object.

Here's an example: Image
⚡ Objects methods

In JavaScript, creating functions within objects is referred to as methods.

Example: Image
Here's how you can invoke this function:

player.greet();
⚡ Object destructuring(ES6)

JavaScript has a nice feature called object destructuring that lets you extract properties from objects and bind them to variables. It is capable of extracting many properties in one statement, accessing properties from nested objects, and ...
settinga default value in the absence of a property.

Syntax:
const { property } = object;

Example: Image
Check out this repository dedicated to frontend development, where I share informative content, tutorials, and practical code examples related to best practices in frontend development.

Check it out here: github.com/ishratUmar18/u…
That's pretty much it for today. I really hope you find this thread helpful. Thank you for reading!

If you found it helpful, like and retweet the first tweet and follow me
@ishrratumar for more content.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Ishrat

Ishrat Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @ishrratumar

Aug 15
Arrays in JavaScript 🚀

A Thread ↓ Image
⚡ Array

In JavaScript, arrays are ordered lists. A single variable called an array is used to hold various elements. It is frequently used if we need to store a list of elements and access them using a single variable.

Create an Array:

let arr = [10, 20, 30] ;
⚡ Accessing Array Elements

The values in an array are referred to as elements. Utilizing the index number, you can get to a specific array element.

Arrays are 0 indexed. In other words, you would use the 0 index to access the first item in the list. Image
Read 11 tweets
Aug 9
JavaScript Conditional Statements 🚀

A Thread ↓ Image
⚡ Conditional Statements
Sometimes, depending on the condition, you might want to perform different actions. To do this, you can use conditional statements in JavaScript.

The following are different types of CS:
✧ if
✧ else
✧ else-if
✧ switch
✧ ternary operator
✧ if
The `if` statement is used to write a block of code that will run only if a certain condition is true.

Example:
if (50 > 5) {
let result = "Yes, 50 is greater than 5!";
}
// Output: "Yes, 50 is greater than 5!"
Read 11 tweets
Jul 10
JavaScript basics for absolute beginners✨

A Thread ↓
JavaScript is a robust programming language that is commonly used for web development. It helps you create dynamic and interactive web pages.

The foundations of JavaScript are as follows:
1. Print Hello World

JavaScript allows you to either include your code internally in an HTML file or externally in a different JavaScript file.
Read 15 tweets
Jun 19
Learn the basics of CSS Grid🎯

A Thread ↓ Image
What is Grid ?

It is a two-dimensional grid-based layout system.

Designing web pages has become easy with grids. It can have items placed on it vertically, horizontally, or both at once. You can arrange items however you want, even stacked. Image
Grid terminology

It is important to understand Grid terminology before learning about its properties.

Let’s jump right in👇
Read 12 tweets
Jun 7
15 Front-End Development Tools/Resources 🎯

A Thread ↓
1) Visual Studio Code

Visual Studio Code is an open-source IDE. It's a simple code editor for cross-platform development and web/cloud applications.

Find: code.visualstudio.com
2) HTML

HTML(Hyper Text Markup Language) is the standard markup language for Web pages.

Learn: w3schools.com/html/
Read 17 tweets
May 9
HTML Forms and Validations🎯🚀

A thread ↓ Image
✧ A valid HTML form ensures that the user's input meets the required criteria and is correct.

✧ Using HTML attributes for form validation or JavaScript for more complex logic will let you implement more sophisticated validation logic.
HTML Input Attributes:

↬ required
↬ type
↬ pattern
↬ max & min
Read 16 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(