Skip to main content

JavaScript Short Notes

JavaScript Short Notes




JavaScript Arrays Destructuring

Assigning array items to variable

const [a, b, c] = [123, 'second', true];

//a => 123
//b => 'second'
//c => true


Skipping items

const [, b] = [123, 'second', true];
//b => 'second'


Assigning the first value, storing the rest together

const [a, b, ...rest] = [123, 'second', true, false, 42];

//a => 123
//b => 'second'
//c => [true, false, 42]


Swapping variables

let x = true;
let y = false;
[x, y] = [y, x]

//x => false
//y => true


















Comments

Popular posts from this blog

All About Microservices Architecture

All About Microservices Architecture **Microservices Architecture** is an approach to software development where a large application is broken down into smaller, independent services that can operate and be deployed independently. Instead of building a monolithic application, which is a single, tightly-integrated unit, microservices architecture divides the functionality into separate services that communicate with each other through well-defined APIs (Application Programming Interfaces). Key characteristics of microservices architecture include: 1. **Modularity:** Each microservice represents a specific business capability and can be developed, deployed, and scaled independently. 2. **Independence:** Microservices are autonomous, meaning they can be developed, deployed, and updated without affecting the entire system. This independence allows for faster development cycles. 3. **Scalability:** Since each service is independent, you can scale only the specific microservices that require...

Natural Language Processing (NLP)

What is Natural Language Processing (NLP) ? Natural Language Processing (NLP)* is a field of artificial intelligence (AI) that focuses on the interaction between computers and humans using natural language. It involves the development of algorithms and models that enable computers to understand, interpret, and generate human language. Here are key aspects of NLP: 1. *Text Understanding:* NLP systems aim to comprehend the meaning of written or spoken language. This involves tasks such as text classification, sentiment analysis, and named entity recognition. 2. *Speech Recognition:* NLP extends to processing spoken language, converting audio signals into text. This technology is used in voice assistants, transcription services, and more. 3. *Language Generation:* NLP systems can generate human-like text. This is employed in chatbots, language translation services, and content generation. 4. *Machine Translation:* NLP is fundamental to machine translation systems that enable the automatic...

Photo Composition

Rules are made to be broken but are also made for a reason. Our ‘go to’ is the widely known ‘rule of thirds’ and is considered in the majority of our intentional compositions. But what other compositions do we use? 1 - Golden Spiral : Based on the Fibonacci numbers, this composition uses arcs infinitely resembling a spiral shape, which can be used to create balanced and aesthetically pleasing photos. 2 - Cross : A simple but harmonious composition using two lines, creating a midsection crosshair with the subject in the center of the frame. 3 - Tunnel : Similar to ‘leading lines’ tunnel composition is used to draw your eye to a subject using depth. 4 - L Shape : The L-shape composition appears when the elements create the “L” shape which can be (and often is) multiplied. The static horizontal and vertical lines this kind of composition presents create the feeling of rest, stillness, and harmony. 5 - S Curve : The curved lines in an S-curve composition add a sense of movement to an other...